to find smallest of three numbers using nested if else statement
Answers
Answer:
write a C program to find the smallest number among three numbers u
Answer:
C Program to find the smallest of the three distinct numbers.
Program: (Dynamic)
#include <stdio.h>
int main()
{
int num1,num2,num3;
scanf("%d %d %d",&num1,&num2,&num3); //Reading 3 integer values
if(num1<num2)
{
if(num1<num3)
{
printf("%d is the smallest one among [%d, %d, %d]", num1, num1, num2, num3);
}
else
{
printf("%d is the smallest one among [%d, %d, %d]", num3, num1, num2, num3);
}
}
else
{
if(num2<num3)
{
printf("%d is the smallest one among [%d, %d, %d]", num2, num1, num2, num3);
}
else
{
printf("%d is the smallest one among [%d, %d, %d]", num3, num1, num2, num3);
}
}
return 0;
}
Input:
72 89 64
Output:
64 is the smallest one among [72, 89, 64]
Learn more:
1. Below is the list of various types of application software: A. Database B. Desktop publishing...
2. ________ allows showing the values of the measured field which decides the size of the circles
Explanation: