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 is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
explain what is an endless loop?
What is main () in c?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
How do I create a directory? How do I remove a directory (and its contents)?
Explain what does the format %10.2 mean when included in a printf statement?
Can math operations be performed on a void pointer?
What are the primitive data types in c?
What are the advantages of union?
What is the total generic pointer type?
Why do we use c for the speed of light?
Is struct oop?
Why does this code crash?
Is c weakly typed?
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none