Menus

Saturday, 23 April 2022

Largest of three numbers in C

 #include <stdio.h>

int main()

{

 int x,y,z;

 clrscr();

 printf("Enter three numbers :");

 scanf("%d,%d,%d",&x,&y,&z);


 if(x>y)

 {

   if(x>z)

     printf("Largest value : %d ",x);

   else

     printf("Largest value : %d ",z);

 }

 else

 {

   if(y>z)

     printf("Largest value : %d",y);

   else

     printf("Largest value : %d",z);

 }


 getch();

}

No comments:

Post a Comment