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

Answer Posted / ruchi

#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 ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to generate the Fibinocci Series

668


Do you know what are bitwise shift operators in c programming?

588


Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

654


Can we declare variable anywhere in c?

538


Where are local variables stored in c?

571






What are local variables c?

552


stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.

1856


Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

692


GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA

1432


what is the different bitween abap and abap-hr?

1745


Did c have any year 2000 problems?

658


How was c created?

590


Why do some versions of toupper act strangely if given an upper-case letter?

635


What was noalias and what ever happened to it?

592


Write the syntax and purpose of a switch statement in C.

629