in this if condition while cheking greatest of two numbers a value only printed irrespective of their value. If b is greater again a only printed. why is it so? help me to find out the hidden concept. Thank you.
2007-06-18
19:22:33
·
2 answers
·
asked by
Kannan
1
in
Science & Mathematics
➔ Mathematics
#include
#include
main()
{
int a,b;
clrscr();
printf("enter the value for a:");
scanf("%d",&a);
printf("enter the value for b:");
scanf("%d",&b);
if(a-b)
{
printf("a is greater");
printf("\nThe value of a is:%d",a);
}
else
{
printf("b is greater");
printf("\nThe value of b is:%d",b);
}
getch();
}
2007-06-18
19:30:41 ·
update #1