Studytonight is now part of the GUVI universe. Explore GUVI →
🤩 New Cool Developer Tools for you. Explore →
FREE JavaScript Video Series Start Learning →
Signup/Sign In
Tests
MCQs to test your knowledge.
Compilers
Compilers to execute code in browser.
Index
LAST UPDATED: DECEMBER 4, 2020

Program to find Greatest of Three Numbers in C++

Following is the program to find greatest of three numbers.

#include<iostream.h>
#include<conio.h>
int main()
{
 float n1, n2, n3;
 cout << "Enter three numbers: ";
 cin >> n1 >> n2 >> n3;
 if (n1 >= n2 && n1 >= n3)
 {
 cout << "Largest number: " << n1;
 }
 if(n2 >= n1 && n2 >= n3)
 {
 cout << "Largest number: " << n2;
 }
 if(n3 >= n1 && n3 >= n2)
 {
 cout << "Largest number: " << n3;
 }
 getch();
 return 0;
}


Enter three numbers: 34 45 56
Largest number: 56



About the author:
Nikita Pandey is a talented author and expert in programming languages such as C, C++, and Java. Her writing is informative, engaging, and offers practical insights and tips for programmers at all levels.

Learn to Code
Learn and practice coding side-by-side.
NEW
C language Course
115+ coding exercises
Javascript Course
85+ coding exercises

AltStyle によって変換されたページ (->オリジナル) /