To find whether a number is even or odd without using any
conditional operator??
Answer Posted / jai gomathi
/*PROGRAM BY JAI GOMATHI.NS, B.E.*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
char a["oddnumber","evennumber"];
printf("\nEnter a number: ");
scanf("%d",&n);
printf("%s",a[n%2]); //when odd, a[1] will print odd number
getch();
}
| Is This Answer Correct ? | 9 Yes | 3 No |
Post New Answer View All Answers
Why do we write return 0 in c?
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?
Write the Program to reverse a string using pointers.
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. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures
Is c compiled or interpreted?
What is the maximum no. of arguments that can be given in a command line in C.?
write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.
What is the difference between array and structure in c?
Is it valid to address one element beyond the end of an array?
Explain can you assign a different address to an array tag?
Is file a keyword in c?
What are the types of unary operators?
Why do we use stdio h and conio h?
What is the use of define in c?
What is the difference between mpi and openmp?