To find whether a number is even or odd without using any
conditional operator??
Answer Posted / umair jatoi && zain ja
/* ZAIN JATOI AND UMAIR JATOI */
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n;
printf("Enter any number:");
scanf("%d",&n);
if(n&1)
printf("%d is Odd number",n);
else
printf("%d is even number",n);
getch();
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Why is c called "mother" language?
How many types of sorting are there in c?
What is static memory allocation?
I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...
What is the difference between functions getch() and getche()?
Write a code to generate a series where the next element is the sum of last k terms.
Can a variable be both const and volatile?
Are bit fields portable?
Explain how can you avoid including a header more than once?
Explain is it valid to address one element beyond the end of an array?
What is the difference between c and python?
What is FIFO?
What is the mean of function?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....