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 double pointer is used in c?
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
What is a volatile keyword in c?
What is an array in c?
What is the most efficient way to count the number of bits which are set in an integer?
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
Explain two-dimensional array.
What are logical errors and how does it differ from syntax errors?
How many identifiers are there in c?
How can I read in an object file and jump to locations in it?
Describe the header file and its usage in c programming?
Do you have any idea about the use of "auto" keyword?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
a c code by using memory allocation for add ,multiply of sprase matrixes