You are here:   HomeC Programming (Pratical)C Program Write a Program to Find the Greatest Between 3 Number
by Dinesh Thakur Category: C Programming (Pratical)

Let us use variables a, b and c (all of type int) to represent three integer numbers and variable max (also of type int) to represent the maximum of them.

It first accepts the values of variables a, b and c. To determine the maximum number, the larger number of a and b is first assigned to max using the if-else statement. Then the larger of variables max and c, which is the maximum of the three given numbers, is determined using a simple if statement. Finally, the value of max is printed. The program is given below.  




void main()
{
       int a,b,c;
       clrscr();
       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&&a>c)
         {
                 printf("a is Greater ");
         }
      else if(b>a&&b>c)
              {
                   printf("b is Greater");
              }
      else
             {
                   printf("c is Greater");
             }
                   getch();
}

C Program to Find the Greatest Between 3 Number


Search Content







Advance Courses



Basic Courses



Advertise with Us