Pages

Tuesday, March 25, 2025

code to calculate largest of 3 numbers in C++

 #include <iostream>

using namespace std;
// code to find largest of 3 numbers
int main(){
    int a, b, c;
    cout <<"enter a : ";
    cin >> a;
    cout <<"enter b : ";
    cin >> b;
    cout <<"enter c : ";
    cin >> c;

    if(a >= b && a >= c){
        cout <<"Largest is a = " << a << endl;

    } else if(b >= c){
        cout << "Largest is b = " << b << endl;

    } else {
        cout << "Largest is c = " << c << endl;

    }
    return 0;

}

No comments:

Post a Comment

Encode and Decode Strings - NeetCode.IO Solution by me + gemini pro 3.0 explained

  class Solution {         // encode: List of Strings -> String     public String encode ( List < String > strs) {         Stri...