Advertisement
amrulHarahap

Luas dan Keliling Persegi Panjang

Dec 19th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. // Program Menentukan Luas dan Keliling Persegi Panjang
  2. // Task No.1 file 066-P02.pptx
  3. // Amrul Mubarak Harahap
  4. // 19T03 - 1901098
  5.  
  6. #include <iostream>
  7. using namespace std;
  8.  
  9. int main(){
  10.     float p, l, rumusLs, rumusKl;
  11.  
  12.     cout << "=======================================" << endl;
  13.     cout << "Program Menghitung Luas Persegi Panjang" << endl;
  14.     cout << "=======================================" << endl;
  15.    
  16.     cout << "Masukkan panjang : ";
  17.     cin >> p;
  18.     cout << "Masukkan lebar   : ";
  19.     cin >> l;
  20.    
  21.     rumusLs = p*l;
  22.     rumusKl = (2*p) + (2*l);
  23.  
  24.     cout << "Luas persegi panjang dengan panjang = " << p << " cm dan lebar = " << l
  25.     << " cm adalah " << rumusLs << " cm^2" << endl << endl;
  26.  
  27.     cout << "Keliling persegi panjang dengan panjang = " << p << " cm dan lebar = " << l
  28.     << " cm adalah " << rumusKl << " cm" << endl << endl;  
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement