#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter
the value of a and b");
scanf("%d%d",&a,&b);
if(a>=b)
{
printf("a
is Greater");
}
else
{
printf("b
is Greater");
}
getch();
}
Output
Enter the
value of a and b
4
7
b is
Greater
This is stupidly trivial and still plain wrong.
ReplyDelete1) Return value of scanf() is not checked. So if the user enters text instead of numbers, what happens? Sure not what is intended.
2) Enter the same number twice. It would still says that one is greater than the other.