Write a C Program to find the Largest Number (integer) among Three Numbers (integers) using IF and Logical && operator.

Write a C Program to find the Largest Number (integer)  among Three Numbers (integers) using IF and Logical && operator.


In this post we had covered topics:

How to print Largest Number (integer)  among Three Numbers using c, Use of Logical && operator in C. Write a C Program to find the biggest Number (integer)  among Three Numbers 


Here we have used if else statement. If you want to know about if else statement you can go to our previous post here.

  1. #include <stdio.h>

  2. int main()
  3. {
  4.     int n1, n2, n3;

  5.     scanf("%d %d %d", &n1, &n2, &n3);

  6. printf("%d is the largest number.", n1);

  7. It may be n1, n2 or n3.

  8. if(n1>n2&&n1>n3)
  9.   printf("%d is the largest number.", n1);

  10. else if(n2>n1&&n2>n3)
  11.   printf("%d is the largest number.", n2);

  12. else
  13.  printf("%d is the largest number.", n3); 



Input                                                                      Output
-9 -4 -20                     -4 is the largest number. 

You May Like to read also:


Post a Comment

0 Comments