Program Rangkaian Listrik dalam Bahasa C++

#include <iostream>
using namespace std;

int main() {
int pilihan, R1,R2,R3;
float Rs, Rp;

cout<<"PILIHAN : "<<endl;
cout<<"1. SERI"<<endl;
cout<<"2. PARALEL"<<endl;
cout<<"masukkan pilihan anda (1/2) : ";cin>>pilihan;

switch (pilihan){
case 1:
cout<<"R1 : ";cin>>R1;
cout<<"R2 : ";cin>>R2;
cout<<"R3 : ";cin>>R3;
Rs=R1+R2+R3;
cout<<"Total rangkaian seri : "<<Rs<<endl;
break;
case 2:
cout<<"R1 : ";cin>>R1;
cout<<"R2 : ";cin>>R2;
cout<<"R3 : ";cin>>R3;
Rp=(1/((1/R1) + (1/R2) + (1/R3)));
cout<<"Total rangkaian paralel : "<<Rp<<endl;
break;
}
return 0;
}

Comments

Popular posts from this blog

Cara Membuat Halaman Login Hotspot Berbeda pada 1 Mikrotik

UltraISO Premium Edition v9.5.3

Arti OSAKMJ