AlgoritmaTugas5.2

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <cmath> using namespace std; int main() { puts("=========================================="); puts(" Program Menghitung Segitiga Sama Kaki"); puts("=========================================="); int alas, tinggi, mode; cout<<"Masukan Mode\n"<<"[1:Luas, 2:Keliling]\t: "; scanf("%d",&mode); cout<<"\nMasukan Alas Segitiga\t: "; scanf("%d",&alas); cout<<"\nMasukan Tinggi Segitiga\t: "; scanf("%d",&tinggi); cout<<endl; puts("=========================================="); printf("Nilai Alas Adalah\t: %d\n", alas); printf("Nilai Tinggi Adalah\t: %d\n", tinggi); if (mode == 1) { const float luas = (alas * tinggi) * 0.5; printf("Mode yang dipilih\t: Menghitung Luas\n"); printf("Luas Segitiga\t\t: %.2f\n", luas); } else { const float sisiMiring = sqrt(pow(alas,2) + pow(tinggi,2)); const float kell = alas + tinggi + sisiMiring; printf("Mode yang dipilih\t: Menghitung Keliling\n"); printf("Keliling Segitiga\t: %.2f\n", kell); } puts("=========================================="); puts("Irsyad Purbha"); puts("irsyadpurbha.fst@uia.ac.id"); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines