Monday, 7 September 2020

A program to compare three numbers and display the biggest number.

/* A program to compare three numbers and display the biggest number*/


#include
int main ()
{
      int x,y,z;
      printf ("Enter three numbers:");
      scanf("%d %d %d",&x,&y,&z);
      if((x>y)&&(x>z))
      {
   printf("the biggest number is  %d",x);
      }
     else if((y>x)&&(y>z))
     {
  printf("the biggest number is %d",y);
      }
      else

     {
 printf("the biggest number is %d",z);
     }
return 0;
}

OUTPUT:


DESCRIPTION:
Here we ask the user to input three numbers and using 'if' condition we find out the greatest number and display it.

TRY IT YOURSELF:
Write a program to input three numbers and display the smallest number.

No comments:

Post a Comment

If you have any doubt, please ask in the comment section.

Search This Blog

Program to print weather the number is happy or not.

#include <stdio.h> #include <math.h> int main () { int i , j , num , temp , sum = 0 ; printf ( "Enter number\n...