find a number whether it is even or odd without using any
control structures and relational operators?

Answer Posted / ramesh

#include<stdio.h>
#include<conio.h>
main()
{
int n;
char *p[]={"Even","odd"};
clrscr();
printf("Enter the number");
scanf("%d",&n);
n=n%2;
printf("The value is %s",p[n]);
getch();

}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

1513


What does c mean in standard form?

590


Write a program in c to replace any vowel in a string with z?

680


What is calloc() function?

614


What is the function of volatile in c language?

658






How do you print only part of a string?

602


Explain enumerated types in c language?

598


How can I check whether a file exists? I want to warn the user if a requested input file is missing.

647


What is a example of a variable?

538


In C, What is the #line used for?

1037


How do you sort filenames in a directory?

698


Write program to remove duplicate in an array?

591


what is the structure pointer?

1636


What is d'n in c?

624


Do you know the difference between exit() and _exit() function in c?

603