Find the largest number among three number in C++
Find the largest number among three number in C++
#include <iostream>
using namespace std;
int main() {
double n1, n2, n3;
cout << "Enter three numbers: ";
cin >> n1 >> n2 >> n3;
// check if n1 is the largest number
if(n1 >= n2 && n1 >= n3)
cout << "Largest number: " << n1;
// check if n2 is the largest number
else if(n2 >= n1 && n2 >= n3)
cout << "Largest number: " << n2;
// if neither n1 nor n2 are the largest, n3 is the largest
else
cout << "Largest number: " << n3;
return 0;
}
Topics Covered :
- largest among n numbers in c++
- largest among 3 numbers in c++
- c++ program find largest value among three
- programming in c++
- c++ find lagrest value
- c++ progrmming
- c++ language tutorial for beginners
- c++ program
Thanks for reading this blog. Hope you get satisfied with the blog and definitely this blog must have valued your time and effort of reading.
Take a time to connect our other digital creations such as Instagram , Facebook and Youtube.
Social Media Links of Tech DCode :
YouTube : https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
Instagram : https://www.instagram.com/thetechdcode/
Facebook Page : https://www.facebook.com/thetechdcode
Twitter : https://twitter.com/thetechdcode
Telegram Channel : https://t.me/thetechdcode
Tech DCode Linktree : https://linktr.ee/thetechdcode
My Personal Handles : https://linktr.ee/virtualshivamin
Social Media Links of SHIVAM SINGH (OWNER) :
Instagram : https://www.instagram.com/virtualshivamin/
Facebook Page : https://www.facebook.com/virtualshivamin/
Twitter : https://twitter.com/virtualshivamin/
Personal Linktree : https://linktr.ee/virtualshivamin