Nested if-else(programme in c )
Nested if-else(programme in c )
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n1,n2,n3,min;
//get three integer numbers from user
printf("Enter three integer numbers: ");
scanf("%d %d %d",&n1,&n2,&n3);
//find the minimum
if(n1<n2)
{
if(n1<n3)
min=n1;
else
min=n3;
}
else
{
if(n2<n3)
min=n2;
else
min=n3;
}
//print result
printf("Minimum is: %d\n",min);
//terminate main function and return 0 as output
return 0;
}
Comments
Post a Comment