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
How can I find out the size of a file, prior to reading it in?
Is c still used?
What does *p++ do?
What is structure and union in c?
Explain why c is faster than c++?
Is null valid for pointers to functions?
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
What is the main difference between calloc () and malloc ()?
Differentiate between ordinary variable and pointer in c.
What are the advantages of using new operator as compared to the function malloc ()?
What are the advantages of union?
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code
hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel
What are loops in c?
What is a rvalue?