Write a program to find given number is even or odd without
using any control statement.

Answers were Sorted based on User's Feedback



Write a program to find given number is even or odd without using any control statement...

Answer / rani

#include<stdio.h>
#include<conio.h>
void main()
{
char str[][10]={"even","odd"};
int no;
clrscr();
printf("\nEnter a number...");
scanf("%d",&no);
printf("\n%d is %s",no,str[no%2]);
getch();
}

Is This Answer Correct ?    13 Yes 1 No

Write a program to find given number is even or odd without using any control statement...

Answer / saneemask

main()
{

{
char a[][5]= {"Even","Odd"};
int n;
printf("Enter any no.: ");
scanf("%d",&n);
printf("%s",a[n%2]);
getch();
}
{

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More C Interview Questions

code snippet for creating a pyramids triangle ex 1 2 2 3 3 3

4 Answers  


Write a c program to build a heap method using Pointer to function and pointer to structure ?

0 Answers   Wipro,


Average of a couple 10 years ago was 25. The average remains same after having a child and twins after 3 years. What is the present age of the first child

10 Answers   IBM, Infosys,


the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

0 Answers  


can we define a function in structure?

2 Answers  






List a few unconditional control statement in c.

0 Answers  


size maximum allocated by calloc()

3 Answers   DELL,


main() { struct test { char c; int i; char m; } t1; printf("%d %d\n", sizeof(t1), sizeof(t1.c)); }

1 Answers   Vector, Vector India,


How to add two numbers without using arithmetic operators?

18 Answers   College School Exams Tests, e track, Infosys, Pan Parag, Sapient, TCS,


What is a union?

0 Answers  


Write a programm such that if user enter 11.25 it roundup to 11 but if user enter 11.51 upto 11.99 it will round up to 12 i.e.;convert the floting point value into integer format as explain above..

2 Answers  


Can I pass constant values to functions which accept structure arguments?

2 Answers  


Categories