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



find a number whether it is even or odd without using any control structures and relational operato..

Answer / vinocit

#include<stdio.h>
int main()
{
int n=10000;
char *s[2]={"Even","Odd"};
printf("%s",s[n&1]);
return 0;
}

Is This Answer Correct ?    47 Yes 11 No

find a number whether it is even or odd without using any control structures and relational operato..

Answer / vinothkumar.r

But its much efficient just to find whether the last bit is
0 or 1

Is This Answer Correct ?    16 Yes 2 No

find a number whether it is even or odd without using any control structures and relational operato..

Answer / d.c.sathishkumar

#include<stdio.h>
main()
{
int n;
char *p[]={"Even","odd"};
Printf("Enter the number");
scanf("%d",&n);
n=n%2;
printf("The value is %s",a[n]);

}

Is This Answer Correct ?    17 Yes 8 No

find a number whether it is even or odd without using any control structures and relational operato..

Answer / shashi

#include<stdio.h>
main()
{
int n;
string s[2]={"Even","odd"};
Printf("Enter the number");
scanf("%d",&n);
n=n%2;
printf("The value is %s",s[n]);

}

Is This Answer Correct ?    11 Yes 2 No

find a number whether it is even or odd without using any control structures and relational operato..

Answer / vignesh1988i

the first answer is excellent .... superb..... this is what
i expected........ marvalous.......... congrats



thank u

Is This Answer Correct ?    10 Yes 5 No

find a number whether it is even or odd without using any control structures and relational operato..

Answer / vamsi

#include<stdio.h>
main()
{
int n;
string p[2]={"Even","odd"};
Printf("Enter the number");
scanf("%d",&n);
n=n%2;
printf("The value is %s",p[n]);

}

Is This Answer Correct ?    13 Yes 8 No

find a number whether it is even or odd without using any control structures and relational operato..

Answer / vignesh1988i

mind you sir == is an relational operator.................



thank u

Is This Answer Correct ?    5 Yes 1 No

find a number whether it is even or odd without using any control structures and relational operato..

Answer / abhradeep chatterjee

ya. the first answer has impressed me.

#include<stdio.h>
main()
{
int n;
string p[2]={"Even","odd"};
Printf("Enter the number");
scanf("%d",&n);
n=n%2;
printf("The value is %s",p[n]);

}

Is This Answer Correct ?    5 Yes 1 No

find a number whether it is even or odd without using any control structures and relational operato..

Answer / ruchi

#include<stdio.h>
#include<conio.h>
main()
{
int n;
char *p[]={"Even","odd"};
clrscr();
printf("Enter the number");
scanf("%d",&n);
n=n%2;
printf("The value is %s",p[n]);
getch();

}

Is This Answer Correct ?    5 Yes 1 No

find a number whether it is even or odd without using any control structures and relational operato..

Answer / ramesh

#include<stdio.h>
#include<conio.h>
main()
{
int n;
char *p[]={"Even","odd"};
clrscr();
printf("Enter the number");
scanf("%d",&n);
n=n%2;
printf("The value is %s",p[n]);
getch();

}

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More C Interview Questions

Explain how can you check to see whether a symbol is defined?

0 Answers  


Explain a file operation in C with an example.

0 Answers   Amdocs,


Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?

0 Answers  


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

0 Answers  


Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

0 Answers  






what is the syallabus of computer science students in group- 1?

0 Answers  


What are the two forms of #include directive?

0 Answers   Aspire, Infogain,


1) int main() { unsigned char a = 0; do { printf("%d=%c\n",a,a); a++; }while(a!=0); return 0; } can anyone please explain the explain the output

2 Answers  


union { char ch[10]; short s; }test; test.s = 0xabcd; main() { printf("%d",ch[10]); }

3 Answers  


Write a program to print all permutations of a given string.

0 Answers   JPMorgan Chase,


Tell us bitwise shift operators?

0 Answers  


What do the functions atoi(), itoa() and gcvt() do?

0 Answers   Aspire, Infogain,


Categories