How to find greatest of three numbers using multiple if statement in C Language

Introduction: In previous article i explained the program for Else if ladder to perform operation on two numbers based on operator in C language .In this article i will explain How to find greatest of three numbers using multiple if statement  in C Language. Let's create a program to understand.

#include<conio.h>
#include<stdio.h>
main()
{
      int a,b,c,big;
      printf("Enter first number: ");
      scanf("%d",&a);
      printf("Enter second number: ");
      scanf("%d",&b);
      printf("Enter third number: ");
      scanf("%d",&c);
      if(a>b)
      {
          big=a;
      }
      if(a<b)
      {
          big=b;
      }
      if(big<c)
      {
      big=c;        
      }
      printf("Biggest number=%d",big);
                 getch();
      }
  •  Run the program using Ctrl+F9
Output

Enter first number:  45
Enter second number:  90
Enter third number: 99

Biggest number=99

Previous
Next Post »

If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..