find a number whether it is even or odd without using any
control structures and relational operators?
Answers were Sorted based on User's Feedback
Answer / ramya
A number anded with the lower number that is n & (n - 1) =
0 then it is even if it is anything else it is odd
odd_even (int n)
{
if (!(n & (n -1))
number is odd
else
number is even
}
| Is This Answer Correct ? | 9 Yes | 29 No |
Answer / guest
#include<stdio.h>
#include<conio.h>
void main()
{
int x;
if(x%2==0)
printf("even");
else
printf("odd");
getch();
}
| Is This Answer Correct ? | 4 Yes | 25 No |
The operation of a stair case switch best explains the a) or operation b) and operation c)exclusive nor operation d)exclusive or operation Which of the following is/are syntactically correct? a) for(); b) for(;); c) for(,); d) for(;;);
1 Answers HCL, Public Service Commission,
Would you rather wait for the results of a quicksort, a linear search, or a bubble sort on a 200000 element array? 1) Quicksort 2) Linear Search 3) Bubble Sort
Explain what is the difference between a string and an array?
What is sizeof c?
What is the size of enum in c?
How can I automatically locate a programs configuration files in the same directory as the executable?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?
When should you not use a type cast?
#include<string.h> void main() { String s1[]={"swathi"}; string s2[]={"maddimsetti"}; s1[]=s[]; printf("%s",s1[]); }
define switch statement?
what is the maximum limit of row and column of a matrix in c programming. in linux .
can anyone proide me reading material on svit00ef27@yahoo.com please thanx in advance