14 : Write a C program that accepts three integers and find the maximum of three.

/*
 Write a C program that accepts three integers and find the maximum of three. 
Test Data :
Input the first integer: 25
Input the second integer: 35
Input the third integer: 15
Expected Output:
Maximum value of three integers: 35
*/
#include<stdio.h>
main(void)
{
int num1;
printf("Input the first integer:");
scanf("%d",&num1);
int num2;
printf("Input the Second integer:");
scanf("%d",&num2);
int num3;
printf("Input the Third integer:");
scanf("%d",&num3);
if(num1>num2 && num1>num3)
{
printf("The First integer is greater");
}
else if(num1==num2)
{
printf("The first and second integer are equal");
}
else if(num1==num3)
{
printf("The first and third integer are equal");
}
else if(num1==num3)
{
printf("The first and third integer are equal");
}
else if(num2==num3)
{
printf("The second and third integer are equal");
}
else if(num2>num1 && num2>num3)
{
printf("The Second integer is greater");
}
else
{
printf("The Third integer is greater");
}
}

Comments