Segitga dengan C++

Tuesday, March 29, 2011 7:54 AM by Computer and Programming
#include <iostream.h>
#include <conio.h>
void hitung_luas (int a, int t){
int luas;
luas = a * t / 2;
cout << "Luas :" << luas << "\n";
return;}
void hitung_keliling (int a1, int a2, int a3)
{int keliling;
keliling = a1 + a2 + a3;
cout << "Keliling :" << keliling << "\n";
return ;}
main (){
int a, t, a1, a2, a3;
cout << "Hitung Luas dan Keliling Segitiga" << endl;
cout << "Masukkan Alas :" ; cin >> a;
cout << "Masukkan Tinggi :" ; cin >> t;
cout << "Masukkan a1 :" ; cin >>a1;
cout << "Masukkan a2 :" ; cin >>a2;
cout << "Masukkan a3 :" ; cin >>a3;
hitung_luas (a, t);
hitung_keliling (a1, a2, a3);
getch();
return 0;
}

0 Response to "Segitga dengan C++"

Post a Comment