Below is C program to Largest among 3 variables using nested if .
Program:
/* Find largest among 3 variables using nested if */ #include<stdio.h> int main() { int a,b,c; printf("Enter 3 numbers: \n"); scanf("%d %d %d",&a,&b,&c); if(a>=b) { if(a>=c) printf("%d is largest",a); else printf("%d is largest",c); } else if(b>=c) printf("%d is largest",b); else printf("%d is largest",c); return 0; }
No comments:
Post a Comment