what is the other ways to find a logic to print whether a
number is an even or odd wit out using % symbol??????? i
know three different ways to print it. so i need any other
different logic>>>>>
Answer Posted / abdur rab
Sorry i forgot to change the variable name. this ud work
#include <stdio.h>
int main ( int argc, char* argv[] )
{
int _number;
char _value[2][5]={"EVEN", "ODD"};
printf( "Enter an ineteger :" );
scanf( "%d", &_number );
printf( "\nThe given number is :%s", _value [
_number &
0x1 ] );
return ( 0 );
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is advantage of pointer in c?
Do you know the difference between malloc() and calloc() function?
Explain bitwise shift operators?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
What is the purpose of main( ) in c language?
Explain what is the difference between a free-standing and a hosted environment?
What is a macro in c preprocessor?
What is a void * in c?
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
What are pointers in C? Give an example where to illustrate their significance.
What is the difference between call by value and call by reference in c?
Why is not a pointer null after calling free?
What is pragma in c?
cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration
How do you do dynamic memory allocation in C applications?