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

What's the right way to use errno?

627


What is a dynamic array in c?

598


What is a good data structure to use for storing lines of text?

600


Can we declare a function inside a function in c?

591


What does #pragma once mean?

690






Is main an identifier in c?

606


what is stack , heap ,code segment,and data segment

2224


What are the difference between a free-standing and a hosted environment?

746


What will the preprocessor do for a program?

593


How can you invoke another program from within a C program?

619


to find the closest pair

1824


What is type qualifiers?

664


What is unary operator?

661


Describe how arrays can be passed to a user defined function

785


How can I delete a file?

631