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

Is c programming hard?

0 Answers  


If null and 0 are equivalent as null pointer constants, which should I use?

0 Answers  


How can you avoid including a header more than once?

0 Answers  


WHAT IS LOW LEVEL LANGUAGE?

2 Answers  


Write a progarm to find the length of string using switch case?

0 Answers   TCS,


Do you know what is the purpose of 'extern' keyword in a function declaration?

0 Answers  


How can you find the exact size of a data type in c?

0 Answers  


how can i include my own .h file EX:- alex.h like #include<alex.h>, rather than #include"alex.h"

1 Answers  


What is call by reference in functions?

1 Answers  


1)what are limitations for recursive function? 2)write a program to read a text file and count the number of characters in the text file

1 Answers  


how does the for loop work actually..suppose for the following program how it ll work plz explain to me for(i=5;i>=0;i--) prinf(i--);

19 Answers   RMSI,


What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; main() { BAD g1; g1=1; printf("%d",g1); }

4 Answers   ADITI,


Categories