Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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 in detail how strset (string handling function works )pls explain it with an example.

1 Answers  


prog for 1st five prime numbers in 2^x - 1

0 Answers  


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

0 Answers  


WHO WROTE C LANGUAGE?

4 Answers  


which will return integer? a) int*s ( ) b) ( int* ) s( ) c) int ( *s ) ( )

1 Answers   C DAC,


Why is c known as a mother language?

0 Answers  


Implement bit Array in C.

0 Answers   GrapeCity,


What are # preprocessor operator in c?

0 Answers  


What are the types of data structures in c?

0 Answers  


6)swap(int x,y) { int temp; temp=x; x=y; y=temp; } main() { int x=2;y=3; swap(x,y); } after calling swap ,what are yhe values x&y?

3 Answers  


In the following control structure which is faster? 1.Switch 2.If-else and which consumes more memory?

4 Answers  


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

3 Answers  


Categories