In this c programming example we will learn how to compare three integeres.
Algorithm
Take three integers from user by printf() function
These three integer values we will assign to a, b and c by scanf() function
First compare a,b & a,c, if a is greater than b & c it will print "a is the largest"
Else compate b,a & b,c , if b ia greater than a & c it will print "b is the largest"
Else compate c,a & c,b , if c ia greater than a & b it will print "c is the largest"
If we gives small value for a then else condition will executes and print result as "a is not greate than b"
Simple C example to compare three integers
#include <stdio.h>
int main() {
int a, b,c;
printf("Enter number a : ");
scanf("%d", &a);
printf("Enter number b : ");
scanf("%d", &b);
printf("Enter number c : ");
scanf("%d", &c);
if(a > b && a > c)
printf("a is largest ");
else if(b > a && b > c)
printf("b is largest ");
else if(c > a && c > b)
printf("c is largest ");
else printf("No largest number found") ;