Tuesday 30 June 2015

Program 5 : Write a program to select & print the largest of the three nos. using Nested-If-Else statement.

#include<stdio.h>

void main() {

    int a, b, c;

    printf(“Enter the a, b, c value / n”);

    scanf(“ %d, %d, %d”, &a, &b, &c);

    if (a > b) {

        if (a > c) {

            printf(“a is greater”);

        } else {

            printf(“c is greater”);

        }

    } else {

        if (b > c) {

            printf(“b is greater”);

        } else {

            printf(“c is greater”);

        }

    }

}

No comments:

Post a Comment