Pages

Sunday, November 3, 2013

set in resistor

#include<iostream>
#include<iomanip>

using namespace std;

int main()
{

    int res1,res2,res3;
    double a=1.0;
    cout<<fixed<<showpoint;
    cout<<"enter first resistor:"<<endl;
    cin>>res1;
    cout<<"enter second resistor:"<<endl;
    cin>>res2;
    cout<<"enter third resistor:"<<endl;
    cin>>res3;
    
    double resistance;
    resistance=a/((a/res1)+(a/res2)+(a/res3));
    
    cout<<setprecision(1)<<endl;
    cout<<"The combined resistance is"<<setw(3)<<resistance<<"ohms"<<endl;
        return 0;

    }

No comments:

Post a Comment