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...


write a c program to print a given number as odd or even
without using loop statements,(no if ,while etc)

Answers were Sorted based on User's Feedback



write a c program to print a given number as odd or even without using loop statements,(no if ,whi..

Answer / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int m;
printf("0 - odd number \t 1 - even number\n");
printf("enter the number :");
scanf("%d",&m);
printf(" %d ",m&1);
getch();
}


thank u

Is This Answer Correct ?    43 Yes 27 No

write a c program to print a given number as odd or even without using loop statements,(no if ,whi..

Answer / avinash kumar

#include<stdio.h>
main()
{
int a;
clrscr();
printf("enter a number:");
scanf("%d",&a);
if(a%2=0)
printf("even");
else
printf("odd")
getch();
}

Is This Answer Correct ?    25 Yes 22 No

write a c program to print a given number as odd or even without using loop statements,(no if ,whi..

Answer / p.thirugnanavel

#include<stdio.h>
#include<conio.h>
void main()
{
int no,ch;
clrscr();
printf("enter the number :");
scanf("%d",&no);
ch=(no%2==0) ? (1) : (2);
switch(ch)
{
case 1:
printf("The number %d is even",no);
break;
case 2:
printf("The number %d is odd",no);
break;
}
getch();
}

Is This Answer Correct ?    7 Yes 5 No

write a c program to print a given number as odd or even without using loop statements,(no if ,whi..

Answer / dheerendra

logic
main()
{
int a;
(a%2==0)?printf("even"):printf("odd")
}

Is This Answer Correct ?    4 Yes 4 No

write a c program to print a given number as odd or even without using loop statements,(no if ,whi..

Answer / manojkumar

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter the number :");
scanf("%d",&a);
b=a%2;
switch(b)
{
case 1:
printf("The number %d is even",no);
break;
case 2:
printf("The number %d is odd",no);
break;
}
getch();
}

Is This Answer Correct ?    3 Yes 4 No

write a c program to print a given number as odd or even without using loop statements,(no if ,whi..

Answer / bhabesh rai

#include<stdio.h>
main()
{
int n;
printf("Enter an integer:\n");
scanf("%d", &n);
switch((n%2 == 0) ? (1) : (2))
{
case 1:
printf("EVEN\n", n);
break;
case 2:
printf("ODD\n", n);
break;
}
}

Is This Answer Correct ?    2 Yes 3 No

write a c program to print a given number as odd or even without using loop statements,(no if ,whi..

Answer / taesung kim

(number & 1) ? (odd) : (even);

Is This Answer Correct ?    5 Yes 10 No

write a c program to print a given number as odd or even without using loop statements,(no if ,whi..

Answer / vignesh1988i

sorry , just change printf() as.... printf("0 - even number \t 1 - odd number \n ");

thank u

Is This Answer Correct ?    12 Yes 19 No

write a c program to print a given number as odd or even without using loop statements,(no if ,whi..

Answer / jan

bogoon

Is This Answer Correct ?    5 Yes 15 No

write a c program to print a given number as odd or even without using loop statements,(no if ,whi..

Answer / dr:rahul

#include<stdio.h>
#include<conio.h>
void main()
{
int rahul;
printf("0 - odd number \t 1 - even number\n");
printf("enter the number :");
scanf("%d",&rahul);
printf(" %d ",rahul&1);
getch();
}

Is This Answer Correct ?    4 Yes 14 No

Post New Answer

More C Interview Questions

What are data breakpoints?

3 Answers   Adobe,


study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above

15 Answers   Accenture, TCS,


Describe the difference between = and == symbols in c programming?

0 Answers  


How can you increase the size of a dynamically allocated array?

0 Answers   TISL,


Can you explain the four storage classes in C?

0 Answers   TCS,


What is the Purpose of 'extern' keyword in a function declaration?

0 Answers  


how to write a prog in c to convert decimal number into binary by using recursen function,

1 Answers  


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

0 Answers  


what are far pointers?

1 Answers  


write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

0 Answers   Subex,


What is the difference b/w main() in C language and main() in C++.

7 Answers  


biggest of two no's with out using if condition statement

8 Answers  


Categories