Daftar Isi

Jumat, 03 Februari 2012

script c++ "obesitas"

#include <iostream.h>
#include <conio.h>
void main(){
    double a,b,c;
cout<<"apakah anda mengalami obesitas???";
a:;
cout<<"\n\nmasukkan berat badan (dalam kilogram) = ";
cin>>a;
cout<<"masukkan tinggi badan (dalam centimeter) = ";
cin>>b;

c=a/(b/100);

if(c<18.5)
{cout<<"berat badan di bawah normal"<<endl;
}
else if(c>18.5&&c<24.9)
{cout<<"berat badan normal"<<endl;
}
else if(c>25.5&&c<29.9)
{cout<<"berat badan hampir obesitas"<<endl;
}
else if(c>30.0&&c<34.9)
{cout<<"berat badan obesitas rendah"<<endl;
}
else if(c>35.0&&c<39.9)
{cout<<"berat badan obesitas menengah"<<endl;
}
else
{cout<<"berat badan obesitas parah"<<endl;
}

char d;
cout<<"\n\ncoba lagi?(y/n)";
cin>>d;
if(d=='y')
{goto a;
}

cout<<"terima kasih"<<endl;
getch();

}


<<HALAMAN UTAMA

Tidak ada komentar:

Posting Komentar