Find Largest Numbers
Here, you will get and learn the example code to Find Largest of Three Numbers in C Programming. Here we are using if-else and logical operators to create this program.
Program to Find Largest of Three Numbers in C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include<stdio.h> int main() { int a,b,c; //clrscr(); printf("\nEnter the value of a : "); scanf("%d",&a); printf("\nEnter the value of b : "); scanf("%d",&b); printf("\nEnter the value of c : "); scanf("%d",&c); if((a>b) && (a>c)) { printf("\nLargest among %d, %d, %d is %d",a,b,c,a); } else if((b>a) && (b>c)) { printf("\nLargest among %d, %d, %d is %d",a,b,c,b); } else printf("\nLargest among %d, %d, %d is %d",a,b,c,c); //getch(); } |
Output
Check out our other C programming Examples