/*
============================================================================
Name : C-Programming
Author : Code2care
Version : 1.0
Copyright : Code2care.org
Description : 91 : C Program that reads three numbers from user and displays the
smallest among them
============================================================================
*/
#include
#include
int main(void) {
int a, b, c, smallest_no = 0;
printf("C Program to find Smallest among three numbers :");
printf("\nEnter No. A : ");
scanf("%d", &a);
printf("Enter No. B : ");
scanf("%d", &b);
printf("Enter No. C : ");
scanf("%d", &c);
if ((a <= b) && (a <= c)) {
smallest_no = a;
} else if ((b <= a) && (b <= c)) {
smallest_no = b;
}
else {
smallest_no = c;
}
printf("\n The Smallest Number among %d,%d,%d is %d", a, b, c, smallest_no);
return 0;
}
-
Output :
C Program to find Smallest among three numbers :
Enter No. A : 44
Enter No. B : 88
Enter No. C : 99
The Smallest Number among 44,88,99 is 44
C Program to find Smallest among three numbers :
Enter No. A : 99
Enter No. B : 11
Enter No. C : 10
The Smallest Number among 99,11,10 is 10
C Program to find Smallest among three numbers :
Enter No. A : 1
Enter No. B : 2
Enter No. C : 3
The Smallest Number among 1,2,3 is 1
The best way to learn C programming is to practice more and more of programs .
Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.
BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.