Write a program to find the given number is odd or even
without using any loops(if,for,do,while)

Answers were Sorted based on User's Feedback



Write a program to find the given number is odd or even without using any loops(if,for,do,while)..

Answer / shiv kumar

(num/2==0)? printf("even"):printf("odd");

Is This Answer Correct ?    20 Yes 7 No

Write a program to find the given number is odd or even without using any loops(if,for,do,while)..

Answer / kiran

main()
{
int n;
printf("enter the number");
scanf("%d",&n);
n%2==0?(printf("given number is even");):(printf("given
number is odd"););

Is This Answer Correct ?    8 Yes 3 No

Write a program to find the given number is odd or even without using any loops(if,for,do,while)..

Answer / ramu gurram

#include<stdio.h>
int main()
{
int i;
printf("enter a number \n");
scanf("%d",i);
float f=i%2;
f==0 ? printf("given number is even") : printf("given
number is odd");
return 0;
}

Is This Answer Correct ?    3 Yes 1 No

Write a program to find the given number is odd or even without using any loops(if,for,do,while)..

Answer / taesung kim

(num & 1) ? (odd) : (even);

Is This Answer Correct ?    8 Yes 11 No

Post New Answer

More C Interview Questions

list the no of files created when c source file is compiled

9 Answers   TCS,


consider the following C code main() { int i=3,x; while(i>0) { x=func(i); i--; } int func(int n) { static sum=0; sum=sum+n; return(sum); } the final value of x is

4 Answers   TCS,


What is a loop?

0 Answers  


When can a far pointer be used?

0 Answers  


what is a static function

10 Answers   Satyam,






What is string function c?

0 Answers  


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1 Answers   IBM,


what are advantages of U D F?

1 Answers   Google,


what will be the output of this program main() { int i=1; while (i<=10); { i++; } }

11 Answers  


explain memory layout of a C program

2 Answers  


When is an interface "good"?

1 Answers  


where can function pointers be used?

2 Answers  


Categories