10. cara menghitung luas permukaan balok dan volume balok dengan dev c++
#include <iostream>
#include <cstdio>
using namespace std;
int main (){
int p,l,t;
//proses input p,l,t
cout<<"Masukkan nilai p = ";
cin>>p;
cout<<"Masukkan nilai l = ";
cin>>l;
cout<<"Masukkan nilai t = ";
cin>>t;
//proses perhitungan
float v;
v=p*l*t;
float Lp;
Lp=(2*p*l)+(2*p*t)+(2*l*t);
///proses output
cout<<"Volume balok = "<<v<<endl;
cout<<"Luas permukaan balok = "<<Lp<<endl;
return 1;
}
#include <iostream>
#include <cstdio>
using namespace std;
int main (){
int p,l,t;
//proses input p,l,t
cout<<"Masukkan nilai p = ";
cin>>p;
cout<<"Masukkan nilai l = ";
cin>>l;
cout<<"Masukkan nilai t = ";
cin>>t;
//proses perhitungan
float v;
v=p*l*t;
float Lp;
Lp=(2*p*l)+(2*p*t)+(2*l*t);
///proses output
cout<<"Volume balok = "<<v<<endl;
cout<<"Luas permukaan balok = "<<Lp<<endl;
return 1;
}
Komentar
Posting Komentar