C Program to Compare Three Integers

In this c programming example we will learn how to compare three integeres.



  1. Take three integers from user by printf() function
  2. These three integer values we will assign to a, b and c by scanf() function
  3. First compare a,b & a,c, if a is greater than b  & c it will print  "a is the largest"
  4. Else compate b,a & b,c , if b ia greater than a  & c it will print  "b is the largest"
  5. Else compate c,a & c,b , if c ia greater than a  & b it will print  "c is the largest"
  6. 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")  ;

   return 0;



Enter number a : 21

Enter number b : 23

Enter number c : 78

c is largest  


BankManagement System Project

Library Management System Project

Contact Management System Project

Cricket Score Card C Project CSMS

Medical Store Management System project with c

Personal Diary Management System project with c

School Billing Management System project with c

Student Record System project with c