Monday 25 August 2014

GREATER OF THE TWO

Q:-Write a program in C to check which number is greater of the two.

#include<conio.h>
#include<stdio.h>
void main()
{
int a,b;
char ch;
do
{
clrscr();
printf("\nEnter any two numbers\n\n");
scanf("%d %d",&a,&b);
if(a>b)
{
printf("\nA=%d is Greater\n",a);
}
else if(b>a)
{
printf("\nB=%d is Greater\n",b);
}
else
{
printf("\nA=%d and B=%d are equal\n",a,b);
}
printf("\nPress Y to continue\n\n");
ch=getche();
}
while((ch=='y')||(ch=='Y'));
getch();
}


Lmeasy.blogspot.com


No comments:

Post a Comment

Tell Us What You've Got...