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 avoid the abort, retry, fail messages?

1121


What is function in c with example?

1132


What is the best way to store flag values in a program?

1057


I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...

10190


What is #include stdio h and #include conio h?

1089


What does != Mean in c?

1031


When should the register modifier be used? Does it really help?

953


What is clrscr in c?

1123


Lists the benefits of c programming language?

1113


Write a program that accept anumber in words

1742


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

1115


differentiate built-in functions and user – defined functions.

1069


What is array within structure?

1099


Explain the use of bit fieild.

1128


What are predefined functions in c?

1073