Write a C program to find the maximum number between three numbers
Description:
You need to write a C program to find the maximum number between three numbers.
Conditions:
- Create three variables in c with name of number1, number2 and number3
- Find out the maximum number using the nested if-else statement
#include <stdio.h>
int main()
{
int number1, number2, number3;
printf("Enter three numbers: ");
scanf("%d%d%d", &number1, &number2, &number3);
if(number1 > number2)
{
if(number1 > number3)
{
printf("Number1 is max with value of %d",number1);
}
else
{
printf("Number3 is max with value of %d",number3);
}
}
else
{
if(number2 > number3)
{
printf("Number2 is max with value of %d",number2);
}
else
{
printf("Number3 is max with value of %d",number3);
}
}
return 0;
}
Tutorials Class - Output Window
Enter three numbers: 10
20
30
Number3 is max with value of 30
Learn more about the similar topics:
Tutorials |
---|
No Content Found. |
Exercises & Assignments |
---|
No Content Found. |
Interview Questions & Answers |
---|
No Content Found. |