Following is the program to find the greatest no. :-
#include <stdio.h>
int main()
{
int a,b,c;
printf("Program to determine the greatest number among the given two numbers\n");
printf("Please enter the first number\n");
scanf("%d", &a);
printf("Please enter the second number\n");
scanf("%d", &b);
if ((a-b)<=0)
{
printf("%d is greater than %d",b,a);
}
else
{
printf("%d is greater than %d",a,b);
}
return 0;
}
#include <stdio.h>
int main()
{
int a,b,c;
printf("Program to determine the greatest number among the given two numbers\n");
printf("Please enter the first number\n");
scanf("%d", &a);
printf("Please enter the second number\n");
scanf("%d", &b);
if ((a-b)<=0)
{
printf("%d is greater than %d",b,a);
}
else
{
printf("%d is greater than %d",a,b);
}
return 0;
}
Output:-
Note- using the same logic we can design this program in C++ too
Good Start guys keep it u.
ReplyDelete