/*
* 1000+ C programs + tutorials
*
*
* 43_find_smallest_number_amoung_3.c
*
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include
//#include
void main() {
int n1,n2,n3;
int smallest_no;
int temp;
// clrscr();
printf("C Program to Find Smallest Number amound 3 Entered Number");
printf("\n\n Enter Number 1: ");
scanf("%i", &n1);
printf("\n\n Enter Number 2: ");
scanf("%i", &n2);
printf("\n\n Enter Number 3: ");
scanf("%i", &n3);
//Logic to find Smallest Number
if (n1 < n2)
{
if (n1 < n3) {
smallest_no = n1;
}
else {
smallest_no = n3;
}
}
else if (n2 < n3) {
smallest_no = n2;
}
else
{
smallest_no = n3;
}
printf("\n\n Smallest Among Numbers %i,%i and %i : %i",n1,n2,n3, smallest_no);
// getch();
}
-
Output :
C Program to Find Smallest Number among 3 Entered Number
Enter Number 1: 99
Enter Number 2: 98
Enter Number 3: 100
Smallest Among Numbers 99,98 and 100 : 98
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.