semoga menginspirasi buat UTS nya, kalo copas jangan lupa ganti namanya
#include <iostream>
using namespace std;
int main()
{
int i=1;
int menu;
int n;
//UJIAN TENGAH SEMESTER
//LOGIKA DAN ALGORITMA
//SEKOLAH TINGGI ILMU KOMPUTER - SISTEM INFORMASI IB
//ANGGRI LUKMAN DJATTTA
cout<<"========================================================="<<endl;
cout<<" JAWABAN SOAL DERET ARITMATIKA "<<endl;
cout<<" PROGRAMER ANGGRI LUKMAN "<<endl;
cout<<"========================================================="<<endl;
cout<<"1. SOAL DERET ARITMATIKA 2,5,10,17 "<<endl;
cout<<"2. SOAL DERET ARITMATIKA 3,7,11,15"<<endl;
cout<<endl;
cout<<"+==========================================================+";
cout<<endl<<endl;
cout<<"Pilih untuk menghitung : ";cin>>menu;
switch (menu)
{
case 1:{ cout<<"1. SOAL DERET ARITMATIKA 2,5,10,17 "<<endl;
cout<<"masukan n : ";cin>>n;
for (i =1;i<=n;i++){
cout <<i*4-1<<" ";}break;
}
case 2:{ cout<<"2. SOAL DERET ARITMATIKA 3,7,11,15 "<<endl;
cout<<"masukan n : ";cin>>n;
for (i =1;i<=n;i++){
cout <<(i*4)-1<<" "; }break;
}
return 0;
}
}
Tidak ada komentar:
Posting Komentar