To find whether a number is even or odd without using any
conditional operator??
Answer Posted / kala
main()
{
int n;
printf("enter the number\n");
scanf("%d",&n);
if(n%2==0){
printf("number is even");}
else{
printf("number is odd");
}
}
or
if(n&1==0)
printf("even number");
else
printf(odd number");
| Is This Answer Correct ? | 31 Yes | 38 No |
Post New Answer View All Answers
Explain what is the purpose of "extern" keyword in a function declaration?
What is zero based addressing?
What does %c do in c?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
What is the difference between int main and void main?
Why is c called a structured programming language?
How are strings stored in c?
Write a program for Overriding.
What do you mean by c what are the main characteristics of c language?
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
which is conditional construct a) if statement b) switch statement c) while/for d) goto
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.
What is openmp in c?
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none