How to find the given no is odd or even without checking of
any condition and loops. (Hint: Using array)
Answer Posted / 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 |
Post New Answer View All Answers
Why array is used in c?
main() { printf("hello"); fork(); }
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
C program to find all possible outcomes of a dice?
Explain what is a const pointer?
pierrot's divisor program using c or c++ code
How can a process change an environment variable in its caller?
c program to compute AREA under integral
What does. int *x[](); means ?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?
What is null character in c?
What are the advantages of union?
what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above
What is the use of the function in c?
Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80