Menghitung volume Tabung Di C++
program menghitung volume tabung:
//menghitung volume tabung.cpp
#include <iostream>
using namespace std;
int main()
{
const int N=10;
const float phi = 3.14152;
float diameter, tinggi, volume;
char off;
cout << "Masukkan diameter tabung : ";
cin >> diameter;
cout<<"masukkan tinggi tabung:";
cin>>tinggi;
volume = phi * diameter*tinggi;
cout << "volume = " << volume << '\n';
cin >> off;
return 0;
}
//menghitung volume tabung.cpp
#include <iostream>
using namespace std;
int main()
{
const int N=10;
const float phi = 3.14152;
float diameter, tinggi, volume;
char off;
cout << "Masukkan diameter tabung : ";
cin >> diameter;
cout<<"masukkan tinggi tabung:";
cin>>tinggi;
volume = phi * diameter*tinggi;
cout << "volume = " << volume << '\n';
cin >> off;
return 0;
}
No comments: