In this tutorial, we are going to learn the writing program in C to find the smallest number among 3 given integers.
So here our problem statement is, we have given 3 integers and we have to find the smallest number among three.
For Example
We Will Give 3 integers like 4,1,9. Here we will get output 1 because 1 is the smallest among three.
How our program will behave?
- Program will take 3 integers as an input and it will return 1 integer as an output which will be smallest/minimum.
- We are using if else statement to compare the elements.
- Our logic is like we will pick one element and compare it with the rest two. If picked integer is smallest then we will print that picked number as smallest number. If not then we will pick another number and compare it with others two.
C Program to find Smallest number among three
#include<stdio.h> void main(){ int a,b,c; printf("enter the value of a: "); scanf("%d",&a); printf("enter the value of b: "); scanf("%d",&b); printf("enter the value of c: "); scanf("%d",&c); if(a<=b && a<=c) printf(" a = %d is smallest",a); if(b<=a && b<=c) printf("b = %d is smallest",b); if(c<=a && c<=b) printf("c = %d is smallest",c); }
Output

Share on
Also Prepare Below Important Question
- Java Program to Perform Left Rotation on Array Elements by Two
- Java Program to Perform Right Rotation on Array Elements by Two
- Java Program to Print Odd Numbers from Array
- Java Program to Print All Even Numbers in Array
- Java Program to Find the Sum of Array Elements
- Java Program to Delete Element of Array At Given Location
- Java Program to Delete a given Element of Array
- Java Program to Delete Element at End of Array
- Java Program to Insert Element in Array at given Location
- Java Program to Insert Element At the End of Array
- Java Program to Print Length of an Array
- Reverse Array without using Second Array or inplace Reversal Java Program
- Java Program to Print Array in Reverse Order
- Java Program to Sort String Character in Descending order
- Java Program to Sort String in Ascending Order
- Java Program to Print non Repeating Characters in String
- Java Program to Find Sum of Integers in the String
- Java Program to Remove Duplicates From String
- Java Program to Concatenate two Strings
- Java Program to Check if two Strings are Same
Interview Questions Categories
C Programming Interview Preparation
Core Java Programming Interview Preparation
- Core Java Programming Coding Questions
- Core Java Pattern Programming Questions
- Core Java Programming Interview Questions