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
You can do it without using if even
#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 [ x &
0x1 ] );
return ( 0 );
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What are called c variables?
Explain what is the purpose of "extern" keyword in a function declaration?
What is scope and lifetime of a variable in c?
if p is a string contained in a string?
A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
what are the advantages of a macro over a function?
Is there any demerits of using pointer?
What is the use of function in c?
Explain the use of keyword 'register' with respect to variables.
What is the use of #define preprocessor in c?
Differentiate between calloc and malloc.
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
Why c is called a middle level language?
What is the difference between typedef struct and struct?