15. WAP to determine the smallest of 3 numbers if the numbers are input through keyboard.
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c;
printf("Enter the numbers: ");
scanf("%d%d%d",&a,&b,&c);
if(a<b && a<c)
printf("%d is the smallest number.", a);
else if(b<a && b<c)
printf("%d is the smallest number.", b);
else
printf("%d is the smallest number.", c);
getch();
}
OUTPUT:
Please have a look at the below video lesson posted on my YouTube channel:
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c;
printf("Enter the numbers: ");
scanf("%d%d%d",&a,&b,&c);
if(a<b && a<c)
printf("%d is the smallest number.", a);
else if(b<a && b<c)
printf("%d is the smallest number.", b);
else
printf("%d is the smallest number.", c);
getch();
}
OUTPUT:
No comments:
Post a Comment