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

Whether there can be main inside another main?If so how does it work?

14 Answers   Sail, Wipro,


what is disadvantage of pointer in C

13 Answers   Tech Mahindra,


What is the purpose of the statement: strcat (S2, S1)?

0 Answers  


What is table lookup in c?

0 Answers  


Why C language is a procedural language?

0 Answers   Ericsson,






Why & is used in c?

0 Answers  


why TCS selected more student in the software field from all institution.

5 Answers   TCS,


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

0 Answers  


What are the rules for the identifier?

0 Answers  


What is structure in c definition?

0 Answers  


write a program to generate address labels using structures?

0 Answers   SJC,


int a=20; int b=30; int c=40; printf("%d%d%d"); what will be the output?

5 Answers   CMC,


Categories