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

What is the advantage of c?

0 Answers  


What is c language & why it is used?

0 Answers  


What are the average number of comparisons required to sort 3 elements?

2 Answers   DRDO,


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

0 Answers   Aspire, Infogain,


write a programming in c language, 1 3 5 7 9 11

2 Answers   NIIT,






What is a ternary operator in c?

0 Answers  


Why is c faster?

0 Answers  


Write a function that accepts a sentence as a parameter, and returns the same with each of its words reversed. The returned sentence should have 1 blank space between each pair of words. Demonstrate the usage of this function from a main program. Example: Parameter: “jack and jill went up a hill” Return Value: “kcaj dna llij tnew pu a llih”

5 Answers   Mind Tree,


What are extern variables in c?

0 Answers  


c program to print a name without using semicolon

9 Answers   TCS, Wipro,


please explain every phase in the "SDLC" in the dotnet.

0 Answers  


How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST

6 Answers   Adobe, Huawei,


Categories