Write a program to find the largest of three numbers using nested if else.
- Introduction to problem
- Algorithm
- Flowchart
- Program in C language
- Output
Introduction to Program
Algorithm
Step1: declare three variable named A, B and C
Flow chart
Program in C language
#include<stdio.h>
#include<conio.h>
void main()
{
int num1,num2,num3;
printf("enter any three number\n");
scanf("%d %d %d",&num1,&num2,&num3);
if(num1>num2)
{
if(num1>num3)
{
printf("%d is greater than %d ,%d",num1,num2,num3);
}
else
{
printf("%d is greater than %d ,%d",num3,num1,num2);
}
}
else
{
if(num2>num3)
{
printf("%d is greater than %d ,%d",num2,num1,num3);
}
else
{
printf("%d is greater than %d ,%d",num3,num1,num2);
}
}
}
No comments:
Post a Comment