C Programming Tutorial

Advertisements

Write program to find greatest between three numbers in C



       #include<stdio.h>
       #include<conio.h>
       void main()
       {

              int a,b,c;
              clrscr();
              
              printf("\nEnter value of A : ");
              scanf("%d",&a);

              printf("\nEnter value of B : ");
              scanf("%d",&b);

              printf("\nEnter value of C : ");
              scanf("%d",&c);

              if(a>b  &&  a>c)              
                     printf("\nA is greatest.");

              else if(b>a  &&  b>c)              
                     printf("\nB is greatest.");

              else
                     printf("\nC is greatest.");

              getch();
       }
       
   Output : 

              Enter value of A : 56
              Enter value of B : 89
              Enter value of C : 34
              B is greatest.




Advertisement