Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a c program to print a given number as odd or even
without using loop statements,(no if ,while etc)

Answer Posted / bhabesh rai

#include<stdio.h>
main()
{
int n;
printf("Enter an integer:\n");
scanf("%d", &n);
switch((n%2 == 0) ? (1) : (2))
{
case 1:
printf("EVEN\n", n);
break;
case 2:
printf("ODD\n", n);
break;
}
}

Is This Answer Correct ?    2 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I automatically locate a programs configuration files in the same directory as the executable?

1123


What is difference between Structure and Unions?

1203


Explain the properties of union.

1035


What does p mean in physics?

1003


What are pointers? What are different types of pointers?

1086


Explain what is the general form of a c program?

1046


Explain about the constants which help in debugging?

1328


What does it mean when a pointer is used in an if statement?

1074


What is null pointer in c?

960


In a switch statement, explain what will happen if a break statement is omitted?

1012


What is ambagious result in C? explain with an example.

2566


Do you know what are bitwise shift operators in c programming?

1076


How can I find out how much free space is available on disk?

1026


Is multithreading possible in c?

963


Is javascript based on c?

1019