C program to Find the Largest Number Among Three Numbers

CServer Side ProgrammingProgramming

This program takes the 3 numbers and finds the biggest among all. For this, we will compare the numbers with each other and find out which is the largest

Input: a=2,b=4,c=7
Output:7 Largest Number


This program uses only if statement to find the largest number.


#include <iostream>
using namespace std;
int main() {
   int a,b,c;
   if(a>b) {
      if(a>c) {
         printf("%d Largest Number ",a);
      } else {
         printf("%d Largest Number ",c);
   } else {
      if(b>c) {
         printf("%d Largest Number ",b);
      } else {
         printf("%d Largest Number ",c);
   return 0;
Published on 19-Aug-2019 11:50:53