Program Menghitung Tahanan Total



#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,R2,R3;
double seri,n;
float pararel;

cout<<"Masukan tahanan 1 = ";
cin>>R1;
cout<<"\nMasukan tahanan 2 = ";
cin>>R2;
cout<<"\nMasukan tahanan 3 = ";
cin>>R3;

seri = R1+R2+R3;

n=((1/(float)R1)+(1/(float)R2)+(1/(float)R3));
pararel =1/(float)n;
cout<<"\nHasil Tahanan Total Seri    = "<<seri;
cout<<"\nHasil Tahanan Total Pararel = "<<pararel;

return 0;
}

Comments