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

How to write a code for reverse of string without using string functions?

1862


What functions are used for dynamic memory allocation in c language?

885


Explain what are the standard predefined macros?

912


What is an example of structure?

818


which is an algorithm for sorting in a growing Lexicographic order

1615


How to find a missed value, if you want to store 100 values in a 99 sized array?

1138


how to execute a program using if else condition and the output should enter number and the number is odd only...

1976


What is the best way of making my program efficient?

796


What is the purpose of 'register' keyword?

911


what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)

2160


Can a pointer point to null?

822


What is volatile variable in c with example?

809


What is the use of pointers in C?

868


Difference between strcpy() and memcpy() function?

895


Are local variables initialized to zero by default in c?

789