Tugas5.2

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <string.h> #include <cmath> using namespace std; int main() { int Alas, Tinggi, Mode, SisiMiring; cout<<"======================================================"<<endl; cout<<" Program Menghitung Segitiga Siku-Siku "<<endl; cout<<"======================================================"<<endl; 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); cout<<"\n======================================================"<<endl; cout<<"Nilai Alas adalah \t : "<<Alas<<endl; cout<<"Nilai Tinggi adalah \t : "<<Tinggi; float Luas, Keliling; if (Mode == 1) { Luas = (0.5 * Alas * Tinggi); printf("\nMode yang dipilih \t : Menghitung Luas \nLuas Segitiga Sama Kaki : %.2f ", Luas); } else if (Mode == 2) { double SisiMiring = sqrt(pow(Alas, 2)+pow(Tinggi, 2)); Keliling = SisiMiring + Tinggi + Alas; printf("\nMode yang dipilih \t : Menghitung Keliling \nKeliling Segitiga \t : %.2f ", Keliling); } puts("\n======================================================"); cout<<"Nur Izzati Istiqlal"<<endl; cout<<"nurizzatisql@gmail.com"; cout<<"\nNama = Nur Izzati Istiqlal"<<endl; cout<<"NIM = 1620230004"<<endl; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines