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.
- #include <stdio.h>
- int main()
- {
- int n1, n2, n3;
- scanf("%d %d %d", &n1, &n2, &n3);
- printf("%d is the largest number.", n1);
- It may be n1, n2 or n3.
- if(n1>n2&&n1>n3)
- printf("%d is the largest number.", n1);
- else if(n2>n1&&n2>n3)
- printf("%d is the largest number.", n2);
- else
- printf("%d is the largest number.", n3);
- }
Input Output-9 -4 -20 -4 is the largest number. |
0 Comments