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

Answer Posted / shashi

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

}

Is This Answer Correct ?    11 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between %d and %i in c?

919


How the c program is executed?

868


How pointers are declared?

736


What is use of #include in c?

840


Write a c program to demonstrate character and string constants?

1925


What is extern c used for?

782


In c programming language, how many parameters can be passed to a function ?

877


What is a pointer in c?

1007


What is the difference between malloc calloc and realloc in c?

903


Why do we use header files in c?

822


what is use of malloc and calloc?

1685


What is selection sort in c?

819


1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.

1925


How does normalization of huge pointer works?

894


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

1845