To find whether a number is even or odd without using any
conditional operator??
Answer Posted / amala v
import java.io.*;
public class even {
public static void main(String arg[])throws IOException
{
String a[]={"even","odd"};
int p;
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Enter a number to find:");
int n=Integer.parseInt(br.readLine());
p=n%2;
System.out.println("The Number is :"+a[p]);
}
}
Is This Answer Correct ? | 24 Yes | 7 No |
Post New Answer View All Answers
Describe newline escape sequence with a sample program?
What is putchar() function?
Hai what is the different types of versions and their differences
What is difference between union All statement and Union?
Write a program to print fibonacci series without using recursion?
In a byte, what is the maximum decimal number that you can accommodate?
List some basic data types in c?
What is the purpose of 'register' keyword in c language?
How do I use void main?
What is register variable in c language?
An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode
How many levels of indirection in pointers can you have in a single declaration?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
Is printf a keyword?
How can I change their mode to binary?