[C++] Tìm max của 3 số a, b, c nhập từ bàn phím

[C++] Tìm max của 3 số a, b, c nhập từ bàn phím




Lời giải (Code C++)


#include <iostream>
#include <math.h>
using namespace std;
int main()
{
    double a,b,c,max1;
    cout<<"Nhap a: "; cin>>a;
    cout<<"Nhap b: "; cin>>b;
    cout<<"Nhap c: "; cin>>c;
    max1=a;
    if (b>max1)  max1=b;
    if (c>max1)  max1=c;
    cout<<"So lon nhat la: "<<max1;
    return 0;

}



Comments

Post a Comment

Popular Posts