How to find the given no is odd or even without checking of
any condition and loops. (Hint: Using array)
Answers were Sorted based on User's Feedback
Answer / amala v
import java.io.*;
public class even {
public static void main(String arg[])throws
IOException
{
String a[]={"even","odd"};
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
int n;
System.out.println("Enter no to find");
n=Integer.parseInt(br.readLine());
n=n%2;
System.out.println("given no is "+a[n]);
}
}
| Is This Answer Correct ? | 12 Yes | 3 No |
Answer / vaishu
void main()
{
int n;
char s[]={"even","odd"};
printf("Enter the no.:");
scanf("%d",&n);
n=n%2;
printf("th no. is %s",s[n]);
getch();
}
| Is This Answer Correct ? | 12 Yes | 7 No |
Answer / ligory antony
void main()
{
int n;
char *s[4]={"even","odd"};
printf("Enter the no.:");
scanf("%d",&n);
n=n%2;
printf("th no. is %s",s[n]);
getch();
}
| Is This Answer Correct ? | 6 Yes | 4 No |
Answer / anandi
void main()
{
int n;
char s[20][20]={"even","odd"};
printf("Enter the no.:");
scanf("%d",&n);
n=n%2;
printf("th no. is %s",s[n]);
getch();
}
| Is This Answer Correct ? | 3 Yes | 3 No |
how many error occurs in C language ?
Given a single Linked list with lakhs of nodes and length unknown how do you optimally delete the nth element from the list?
#include main() { int i=1,j=2; switch(i) { case 1: printf("GOOD"); break; case j: printf("BAD"); break; } }
what is link list?
What is a structural principle?
What does the characters “r” and “w” mean when writing programs that will make use of files?
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
What is the purpose of ftell?
i want to job in your company, so how it will be possible.
write a program for egyptian fractions in c?
What are run-time errors?
What is indirect recursion? give an example?