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...

To find whether a number is even or odd without using any
conditional operator??

Answer Posted / jai gomathi

/*PROGRAM BY JAI GOMATHI.NS, B.E.*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
char a["oddnumber","evennumber"];
printf("\nEnter a number: ");
scanf("%d",&n);
printf("%s",a[n%2]); //when odd, a[1] will print odd number
getch();
}

Is This Answer Correct ?    9 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

program to convert a integer to string in c language'

2416


Explain the difference between exit() and _exit() function?

1127


What is enumerated data type in c?

1045


What is a pointer value and address in c?

1076


What is keyword with example?

1025


Write a factorial program using C.

1034


what is event driven software and what is procedural driven software?

2518


What is indirection in c?

1038


What are the features of the c language?

1054


Explain what does the format %10.2 mean when included in a printf statement?

1311


Why can arithmetic operations not be performed on void pointers?

1000


What are lookup tables in c?

965


What is typedef struct in c?

1012


Why c is faster than c++?

992


Explain what are global variables and explain how do you declare them?

1107