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
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
What are the advantages of c language?
Explain the use of keyword 'register' with respect to variables.
When can a far pointer be used?
What is external variable in c?
What is the heap?
What is the -> in c?
Describe explain how arrays can be passed to a user defined function
What are qualifiers in c?
Write a program to check armstrong number in c?
Do you know the purpose of 'register' keyword?
Is array name a pointer?
How would you rename a function in C?
How can a number be converted to a string?
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above