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
Why is python slower than c?
Explain why can’t constant values be used to define an array’s initial size?
What is string function in c?
What is the correct declaration of main?
i want to know the procedure of qualcomm for getting a job through offcampus
How can I do serial ("comm") port I/O?
What is the difference between declaring a variable and defining a variable?
the question is that what you have been doing all these periods (one year gap)
Can you apply link and association interchangeably?
How do you sort filenames in a directory?
Why do we need a structure?
What is difference between stdio h and conio h?
Explain spaghetti programming?
Explain argument and its types.
What is openmp in c?