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 Greatest of Three Numbers in C
✅ Find the Greatest of Three Numbers in C
#include <stdio.h>
int main() {
int a, b, c;
// Input
printf("Enter three numbers:\n");
scanf("%d %d %d", &a, &b, &c);
// Logic to find greatest
if (a >= b && a >= c) {
printf("The greatest number is: %d\n", a);
} else if (b >= a && b >= c) {
printf("The greatest number is: %d\n", b);
} else {
printf("The greatest number is: %d\n", c);
}
return 0;
}
๐ Explanation:
This C program takes three integers as input and determines the greatest among them using simple conditional statements.
It compares the three numbers using nested if-else blocks:
- First checks if
ais greater than or equal to bothbandc. - If not, then checks if
bis greater than or equal to the other two. - If both conditions fail, then
cis the greatest by default.
๐งพ Sample Output:
Enter three numbers: 12 45 33 The greatest number is: 45
๐ Keywords:
Greatest of three numbers, if else in C, compare numbers in C, logic building in C, beginner level C program, C programming basics
๐ Hashtags:
#CProgramming #BeginnerC #MaxOfThree #ComparisonLogic #IfElseC #CodingBasics
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