tugas 5.1

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> using namespace std; //nama:yoga dwi kurniawan //nim: 3420230019 int main() { int panjang, lebar, mode; cout << "===================================" << endl; cout << " Program Percabangan Persegi " << endl; cout << "===================================" << endl; cout << "Masukan Panjang Persegi :\n "; cin >> panjang; cout << "Masukan Lebar Persegi :\n "; cin >> lebar; cout << "===================================" << endl; cout << "Masukan Mode" << endl; cout << "[1: Luas, 2: Keliling] :\n "; cin >> mode; if (mode == 1) { int luas = panjang * lebar; cout << "Mode yang dipilih adalah Luas" << endl; cout << "Luas Persegi adalah : " << luas << endl; } else if (mode == 2) { int keliling = 2 * (panjang + lebar); cout << "Mode yang dipilih adalah Keliling" << endl; cout << "Keliling Persegi adalah : " << keliling << endl; } else { cout << "Mode tidak valid. Pilih 1 atau 2." << endl; } cout << "\n============================" << endl; cout << "Nama : Yoga Dwi Kurniawan" << endl; cout << "Email : yoga2211dwi@gmail.com" << endl; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines