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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is gets() function?

663


Can we initialize extern variable in c?

626


Explain how can I right-justify a string?

618


to find the closest pair

1816


Why malloc is faster than calloc?

585






How can you increase the allowable number of simultaneously open files?

593


What is pragma in c?

623


write a program to concatenation the string using switch case?

1551


Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon

1730


Why enum is used in c?

521


What is the use of gets and puts?

597


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

646


How to get string length of given string in c?

602


Why is structure padding done in c?

639


Explain how do you declare an array that will hold more than 64kb of data?

897