-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
36 lines (31 loc) · 953 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
//exercitiu 1
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Introduceti un numar de 3 cifre: ");
int number = Convert.ToInt32(Console.ReadLine());
while (number < 100)
{
Console.WriteLine("Nr introdus nu este de 3 cifre. Introduceti din nou: ");
number = Convert.ToInt32(Console.ReadLine());
}
int reversedNumber = 0;
while (number != 0)
{
int lastdigit = number % 10;
reversedNumber = reversedNumber * 10 + lastdigit;
number /= 10;
}
int reversedNumSqrt = reversedNumber(Math.Sqrt) ;
if (reversedNumSqrt * reversedNumSqrt == reversedNumber)
{
Console.WriteLine("Nr inversat este patrat perfect");
}
else
{
Console.WriteLine("Nr inversat nu este patrat perfect");
}
}
}