Search This Blog
Welcome to 1printf(), your ultimate destination for C, C++, Linux, Data Structures, and Microcontroller programming! π πΉLearn advanced coding techniques in C& C++ πΉMaster Linux internals & shell scripting πΉDeep dive into Data Structures & Algorithms πΉExplore Embedded Systems & Microcontrollers (8051,UART, RTOS) πΉGet hands-on coding tutorials, project ideas,and interview preparation tips Whether you're a beginner or an experienced programmer, this channel will help you
Featured
- Get link
- X
- Other Apps
Find Smallest of Three Numbers in C
✅ Find the Smallest of Three Numbers in C
#include<stdio.h>
int main() {
int a, b, c;
printf("Enter any three numbers:\n");
scanf("%d %d %d", &a, &b, &c);
if (a <= b && a <= c) {
printf("Smallest number among three is: %d\n", a);
}
else if (b <= a && b <= c) {
printf("Smallest number among three is: %d\n", b);
}
else {
printf("Smallest number among three is: %d\n", c);
}
return 0;
}
π Explanation:
This C program helps you find the smallest number out of three inputs using conditional logic. It compares:
- First if
ais smaller than or equal to bothbandc. - If not, it checks if
bis the smallest. - If both conditions fail,
cis the smallest.
π§Ύ Sample Output:
Enter any three numbers: 12 9 27 Smallest number among three is: 9
π Keywords:
Smallest of three numbers, if else in C, compare numbers in C, minimum value logic, basic C programs, beginner C examples
π Hashtags:
#CProgramming #SmallestNumber #IfElseC #MinOfThree #BeginnerC #LogicInC
Popular Posts
C++ Program for Hybrid Inheritance (All Types Together)
- Get link
- X
- Other Apps
C++ Program for Function Overloading Example
- Get link
- X
- Other Apps
Comments
Post a Comment