Smallest number from three

C program to find smallest number from three :

code

#include<stdio.h>
#include<conio.h>

void main()

{

int  a,b,c,small;

clrscr();

printf(“Enter first value :”);

scanf(“%d”,&a);

printf(“\nEnter second value :”);

scanf(“%d”,&b);

printf(“\nEnter third value :”);

scanf(“%d”,&c);

if(a<b && a<c)

{

small=a;

}

else if(b<a && b<c)

{

small=b;

}

else

{

small=c;

}

printf(“\nThe smallest number is %d among %d , %d , %d”,small,a,b,c);

getch();

}

 


output

Enter first value :34

Enter second value :45

Enter third value :41

The small number is 34 among 34 , 45 , 41

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s