C Program to find Biggest of three numbers
You are Here:
Find Biggest of Three Numbers
In the following example, we will find which of the following numbers (40, 25, 7) is the biggest number.
Example
C Compiler
#include <stdio.h>
int main() {
int a = 40;
int b = 25;
int c = 7;
printf("The numbers are a = %d, b = %d, c = %d\n", a, b, c);
if((a > b) && (a > c))
printf("a = %d is the biggest number", a);
else if(b > c)
printf("b = %d is the biggest number", b);
else
printf("c = %d is the biggest number", c);
return 0;
}
Output
The numbers are a = 40, b = 25, c = 7
a = 40 is the biggest number
Find Biggest of any Given Three Numbers
In the following example, we will find the biggest of any given three numbers.
Example
C Compiler
#include <stdio.h>
int main() {
int a, b, c;
printf("Enter an integer for a = ");
scanf("%d", &a);
printf("Enter an integer for b = ");
scanf("%d", &b);
printf("Enter an integer for c = ");
scanf("%d", &c);
if((a > b) && (a > c))
printf("\na = %d is the biggest number", a);
else if(b > c)
printf("\nb = %d is the biggest number", b);
else
printf("\nc = %d is the biggest number", c);
return 0;
}
Output
Enter an integer for a = 2
Enter an integer for b = 10
Enter an integer for c = 15
c = 15 is the biggest number
In the following example, we will get three inputs from the user simultaneously and display the biggest among those.
Example
C Compiler
#include <stdio.h>
int main() {
int a, b, c;
printf("Enter three integers: ");
scanf("%d %d %d", &a, &b, &c);
if((a > b) && (a > c))
printf("\n%d is the biggest number", a);
else if(b > c)
printf("\n%d is the biggest number", b);
else
printf("\n%d is the biggest number", c);
return 0;
}
Output
Enter three integers: 2 10 15
15 is the biggest number
Reminder
Hi Developers, we almost covered 98% of String functions and Interview Question on C with examples for quick and easy learning.
We are working to cover every Single Concept in C.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.