write a program for even numbers?

Answers were Sorted based on User's Feedback



write a program for even numbers?..

Answer / v.karthikeyan

#include <stdio.h>
main()
{
int num;

printf("Enter a number to know the entered number is odd or
even \n");
scanf("%d",&num);

if (num%2==0)
{
printf(" The number is Even");
else
printf(" The number is Odd")
}
getch();
}

Is This Answer Correct ?    88 Yes 15 No

write a program for even numbers?..

Answer / dwarika

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

Is This Answer Correct ?    56 Yes 6 No

write a program for even numbers?..

Answer / shruti

to print numbers which are even from 0 to 100

main()
{
int i;

puts("THE EVEN NUMBERS ARE:");

for(i = 0 ; i <= 100 ; i++)
{
if(i%2 == 0)
printf("%d", i);
}

}

Is This Answer Correct ?    23 Yes 14 No

write a program for even numbers?..

Answer / sameer.chaudhari

main()
{
int num;

printf("Plz enter the number :=> ");
scanf("%d",&num);

if (!(num & 1))
printf("Even");

getch();
}

Is This Answer Correct ?    41 Yes 33 No

write a program for even numbers?..

Answer / shahbaz

void main()
{
int a,b;
cout<<"Enter number to check is it Even or Odd";
cin>>a;
if(a>=0)
{
if(a%2==0)
{
cout<<"The number is Even ";
}
else
{
cout<<"Number is Odd ";
}
}
else
{
Cout<<"Number is Lesser than Zero 0";;
}
getch();
}

Is This Answer Correct ?    7 Yes 1 No

write a program for even numbers?..

Answer / nirdesh pal

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
printf("enter the number");
scanf("%d",&i);
if(i%2==0)
{
printf("number is even");
else
printf("number is odd");
}
getch();
}

Is This Answer Correct ?    3 Yes 1 No

write a program for even numbers?..

Answer / k.naveen kumar

#include<stdio.h>
#include<conio.h>
main()
{
int a;

printf("Please enter the number :=> ");
scanf("%d",&a);

if (a%2==0)
printf("Even");
else
printf("odd");
getch();
}

Is This Answer Correct ?    1 Yes 0 No

write a program for even numbers?..

Answer / mehak saini

include<stdio.h>
include<conio.h>
void main()
{
inti,num;
printf("enter the number")
scanf(%d",&num);
for(i=1;i=<num;i+1)
{
if(i%2==0)
{
printf("%d",i);
}
}
getch();
}

Is This Answer Correct ?    1 Yes 0 No

write a program for even numbers?..

Answer / joe

#include<stdio.h>
//#include<conio.h>

int main()
{
//clrscr();
int *a;
printf("\nenter the no\n");
scanf("%d",&a);
if(*a <0)
{
printf("\nEnter correct number :\n");
}
else if(*a%2==0)
{
printf("no is even");
}
else
{
printf("odd no");
}
getch();
main();
}

Is This Answer Correct ?    15 Yes 15 No

write a program for even numbers?..

Answer / kannan

what function will do


if (!(num & 1))

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures

0 Answers  


Explain how can I pad a string to a known length?

0 Answers  


Explain threaded binary trees?

0 Answers  


3.write a simple program that will output your name,phone number,e-mail address,and academic major on separate lines 1.create an account and a personal directory for your work b.find out how to create a subdirectory on your system.create one called info c.you will use a text editor to type in your programs and data files.some C systems have a built in text editor;others do not.Find out what text editor you will be using and how to access it.create a text file(not a program) containing your name ,address,and telephone number on separate lines.Next,write the brand of computer you are using and the name of the text editor.Then write a paragraph that describes your past experience with computers.save this file in your info directory. d. find out how to print a file on your system .print out and turn in the file you created in (c).

0 Answers   TCS,


what is pointer

1 Answers   TCS,






When the macros gets expanded?

0 Answers  


What is a function in c?

0 Answers  


What are the 5 data types?

0 Answers  


what is difference between c and c++

4 Answers  


program to print upper & lower triangle of a matrix

2 Answers   TCS,


Find MAXIMUM of three distinct integers using a single C statement

0 Answers  


Main must be written as a.the first function in the program b.Second function in the program c.Last function in the program d.any where in the program

19 Answers   CTS, HCL, TCS,


Categories