PPS Practical 10

PPS Practical 10
  • Aim: Write a program to read three numbers from keyboard and find out maximum out of these three. (nested if else)
  • Code:
    //For turbo C++ remove below comments
    #include <stdio.h>
    //#include<conio.h>
    void main()
    {
        int a,b,c;
        // clrscr();
        printf("Enter Three Numbers : \n");
        scanf("%d%d%d", &a,&b,&c);
        if (a>b){
            if (a>c){
            	printf("Maximum number is : %d",a);
            }else{
            	printf("Maximum number is : %d",c);
            }
        }else{
            if (b>c){
            	printf("Maximum number is : %d",b);
            }else{
            	printf("Maximum number is : %d",c);
            }
        }
        // getch();
    }
  • Output:
  • Output of practical 10

Comments