C Program to find Biggest of three numbers

Last Updated:

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; }

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; }

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; }

Share this Page

Meet the Author