Write a program to print the greatest of 3 numbers using nested-if.
/* Write a program to print the greatest of 3 numbers
using nested-if.*/
#include <stdio.h>
void main()
{
int a,b,c;
printf("Enter
the value of A : ");
scanf("%d",&a);
printf("Enter
the value of B : ");
scanf("%d",&b);
printf("Enter
the value of C : ");
scanf("%d",&c);
if(a>b)
{
if(a>c)
{
printf("A is greatest\n");
}
else
{
printf("C is greatest\n");
}
}
else
{
if(b>c)
{
printf("B is greatest\n");
}
else
{
printf("C is greatest\n");
}
}
getch();
Comments
Post a Comment