GTU PPS Program - 10

10. Write a program to read three numbers from keyboard and find out maximum out of these three. (nested if else).

#include<stdio.h>
#include<conio.h>
int main()
{
    int a,b,c,max=0;
    printf("\t\t\tfinding maximum out of three numbers\n\n");
    printf("\nEnter three numbers a,b and c : ");
    scanf("%d%d%d",&a,&b,&c);
    if(a>b)
    {
        if(a>c)
            max=a;
        else
            max=c;
    }
    else
    {
        if(b>c)
            max=b;
        else
            max=c;
    }
    printf("\nMaximum out of three number is %d",max);
    getch();
    return 0;
}

Sample output

Comments

YouTube

Popular posts from this blog

GTU PPS Program - 15

PPS Program - 22

JavaFX Day - 1