tugas 5.2

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> using namespace std; int main() { puts("======================================================"); puts("Program Menghitung Segitiga Sama Kaki "); puts("======================================================"); int alas, tinggi, mode; cout<<"Masukkan Mode"<<endl<<"[1: Luas, 2: Keliling] \t :"; scanf("%d", &mode); cout<<endl; cout<<"Masukkan Alas Segitiga : ";scanf("%d", &alas); cout<<"\nMasukkan Tinggi Segitiga : ";scanf("%d", &tinggi); puts("\n======================================================"); cout<<"Nilai Alas adalah \t : "<<alas<<endl; cout<<"Nilai Tinggi adalah \t : "<<tinggi; float luas, keliling; luas = (0.5 * alas * tinggi); keliling = (tinggi * alas); if (mode == 1) { printf("\nMode yang dipilih : Menghitung Luas \nLuas Segitiga Sama Kaki : %.2f ", luas); } else if (mode == 2) { printf("\nMode yang dipilih \t : Menghitung Keliling \nKeliling Segitiga Sama Kaki : %.2f ", keliling); } puts("\n======================================================"); cout<<"Nama : Ahmad Lukmsn"<<endl; cout<<"gmail : kemanyourbae02@gmail.com"; puts("\n======================================================"); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines