hambatan total c++

progrman mencari Rt (hambatan total) C++

Gimana ya cara membuat program hambatan rangkaian total Rt di C++, berikut codinganya ..

#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
    float r1,r2,r3,rts,rtp;
    cout<<"masukkan R1 = ";cin>>r1;
    cout<<"\nmasukkan R1 = ";cin>>r2;
    cout<<"\nmasukkan R1 = ";cin>>r3;
    rts=((1/r1)+(1/r2)+(1/r3));
    rtp=r1+r2+r3;
   
    cout<<"\n\nR total seri \t= "<<rts;
    cout<<"\nR total paralel \t= "<<rtp;
   
    return 0;
}

outputnya

terimakasih..


EmoticonEmoticon