Q:

Write C Program to find maximum number using switch case

0

Write C Program to find maximum number using switch case

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <stdio.h>

int main()
{
    int num1, num2;

    //Reading two numbers from user
    printf("Enter two numbers to find maximum number: ");
    scanf("%d%d", &num1, &num2);

    //Condition to check maximum number
    switch(num1 > num2)
    {
        case 0: printf("%d is Maximum number", num2);
            break;

        case 1: printf("%d is Maximum number", num1);
            break;
    }

    return 0;
}

Result:

Enter two numbers to find maximum number: 10

20

20 is Maximum number

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

<< Write C program to print gender (Male/Female) prog...