To find whether a number is even or odd without using any
conditional operator??

Answer Posted / mohd adnan

/* By Mohd Adnan MCA(2007-10) IMS Ghaziabad */
/* by using bit wise operator*/
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
printf("Enter any number:");
scanf("%d",%num);
(num&1)&&printf("Odd Number");
((num&1)==0)&&printf("Even Number");
getch();
}

Is This Answer Correct ?    37 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.

2679


What the different types of arrays in c?

610


Explain how to reverse singly link list.

603


What is sizeof c?

604


What are valid signatures for the Main function?

697






How can I read/write structures from/to data files?

545


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

613


What is c language in simple words?

588


design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.

1492


GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)

678


What are integer variable, floating-point variable and character variable?

603


How to create struct variables?

588


What is the difference between text and binary modes?

638


What does %d do in c?

537


What is sizeof int?

629