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


Please Help Members By Posting Answers For Below Questions

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?

599


explain what is an endless loop?

607


What is main () in c?

584


Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..

641


How do I create a directory? How do I remove a directory (and its contents)?

600






Explain what does the format %10.2 mean when included in a printf statement?

769


Can math operations be performed on a void pointer?

581


What are the primitive data types in c?

565


What are the advantages of union?

624


What is the total generic pointer type?

721


Why do we use c for the speed of light?

603


Is struct oop?

575


Why does this code crash?

612


Is c weakly typed?

569


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

611