/* EXPERIMENT - 3 */ /* AIM : TO PRINT THE LARGEST OF THREE GIVEN NUMBERS. */ /* PROGRAMMER : SHEKHAR A. SHERIKAR */ /* COMPUTER TECHNOLOGY - CM102 (B3) */ main() { long int a,b,c; int loop; clrscr(); loop=10; while(loop!=0) { clrscr(); printf("\n\n\t\t\t - LARGE WIZARD [3] -"); printf("\n\n\t\tThis program will help you to find the largest of"); printf("\n\t\t given three numbers."); printf("\n\n\t\t\tType 1 to continue and 0 to exit : "); scanf("%d",&loop); switch(loop) { case 1 : printf("\n\n\t\t\t Enter the First number : "); scanf("%ld",&a); printf("\n\n\t\t\t Enter the Second number : "); scanf("%ld",&b); printf("\n\n\t\t\t Enter the Third number : "); scanf("%ld",&c); printf("\n\n\n\t\t\t\t - A N S W E R -\n\n\t\t\t"); if((a==b)&&(b==c)) printf(" The numbers are equal."); else { if((a==b)&&(b!=c)) { if(a>c) printf("%ld and %ld are equal aswell as greatest.",a,b); else printf("\t%ld is the greatest.",c); } if((b==c)&&(a!=b)) { if(a>b) printf("\t%ld is the greatest.",a); else printf("%ld and %ld are equal aswell as greatest.",b,c); } if((a==c)&&(c!=b)) { if(a>b) printf("%ld and %ld are equal aswell as greatest.",a,c); else printf("\t%ld is the greatest.",b); } if((a!=b)&&(b!=c)&&(a!=c)) { if((a>b)&&(a>c)) printf("\t%ld is the greatest.",a); if((b>a)&&(b>c)) printf("\t%ld is the greatest.",b); if((c>a)&&(c>b)) printf("\t%ld is the greatest.",c); } } getch(); break; case 0 : clrscr(); printf("\n\n\n\n\n\n\n\n\t\t\t\tPROGRAM TERMINATED !\n\n\n"); printf("\t\t Press any key to return to source file....."); getch(); break; default: clrscr(); printf("\n\n\n\n\n\n\n\n\t\t\t\t INVALID INPUT !\n\n\n"); printf("\t\t\t Press any key to continue....."); getch(); break; } } }