mencari R1,R2,R3:
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int r1,pilih,r2,r3,rs,rp;
cout<<"masukan nilai R1 = ";cin>>r1;
cout<<"masukan nilai R2 = ";cin>>r2;
cout<<"masukan nilai R3 = ";cin>>r3;
rs=r1+r2+r3;
rp=1/r1+1/r2+1/r3;
cout<<"Rangkaian seri (1) atau rangkaian pararel (2) ?";
cin>>pilih;
switch (pilih){
case 1:
cout<<"Rangkaian seri :"<<rs<<endl;
break;
case 2:
cout<<"Rangkaian pararel :"<<rp<<endl;
break;
case 3:
cout<<"Rangkaian pilih :"<<pilih<<endl;
break;
}
return 0;
}
//hasil:
0 komentar:
Posting Komentar