0
write a Programme to enter a number to check it is even or not using simple if
5 Antworten
+ 1
int x = Convert.ToInt32(Console.WriteLine());
If(x % 2 == 0)
{
Console.WriteLine(x + " is even");
}
else
{
Console.WriteLine(x + " us uneven");
}
+ 1
@Andreas has made a mistake:
the right
int x=Convert.ToInt32(Console.ReadLine());
instead of WriteLine
+ 1
@cacao
Thank you :p
Without a compiler checking errors, these things are easy to mess up.
+ 1
@Andreas Yep :P too easy to mess up these little bastards
+ 1
int a = ConvertToInt32(Console.ReadLine());
if (a%2 ==0){
Console.WriteLine("the number {0} is even!", a);
} else {
Console.WriteLine("the number {0} is not even!", a);
}