0
What is error in even/odd program??
num = int(input ("enter any number:")) if (num%2)==0: print("number is even") else: print("number is odd") when I execute this code, it shows syntax error..
3 Answers
+ 2
#Program: Odd Even Number
num = int(input("Enter a number: "))
if (num % 2) == 0:
print("{0} is Even".format(num))
else:
print("{0} is Odd".format(num))
try this you will get your output
0
what language are you using bruh ?
as I assume you use Java or C ,
Scanner scanner = new Scanner(System. in);
int number = scanner.nextInt();
if(number % 2 == 0){
//even here
}else if(number % 2 == 1){
//odd here
}
VisualBasic :
try
Dim number as Integer = CInt( InputBox("Enter Number" , "OddEven" , 0) )
if number mod 2 = 0 then MessageBox.Show("Even")
if number mod 2 = 1 then MessageBox.Show("Odd")
catch ex as exception
MessageBox.Show("something wrong with input")
end try
something like that..