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 the different types of C instructions?
Is c object oriented?
Explain what are reserved words?
c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above
what will be maximum number of comparisons when number of elements are given?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
What are # preprocessor operator in c?
ATM machine and railway reservation class/object diagram
How do you write a program which produces its own source code as output?
Is array name a pointer?
What is boolean in c?
What is the use of pointers in C?
Explain enumerated types in c language?
Write a program to print fibonacci series using recursion?
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.