Program in C to find the second largest number among three numbers
#include<stdio.h> #include<conio.h> void main() { int a,b,c; printf("Enter three no.:-"); scanf("%d%d%d",&a,&b,&c); if(a>b&&a>c) { if(b>c) printf("%d is second greater.",b); else printf("%d is second greater",c); } if(b>a&&b>c) { if(a>c) printf("%d is second greater",a); else printf("%d is second greater",c); } if(c>a&&c>b) { if(a>b) printf("%d is second greater",a); else printf("%d is second greater",b); } getch(); }
Output:-
Related program
0 Comments