0% found this document useful (0 votes)
8 views

Running Till Termination Option Is Entered

Uploaded by

Proxima Yus
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Running Till Termination Option Is Entered

Uploaded by

Proxima Yus
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include<iostream>

using namespace std;

int main()

float V,I,R;

int choice;

for(choice=1;choice<=4;choice++)

cout<<"press 1 to calculate current "<<endl;

cout<<"press 2 to calculate voltage "<<endl;

cout<<"press 3 to calculate resistance "<<endl;

cout<<"press 4 to terminate the program "<<endl;

cin>>choice;

if(choice==1)

cout<<"enter voltage:"<<endl;

cin>>V;

cout<<"enter the resistance: "<<endl;

cin>>R;

I=V/R;

cout<<"the current in the circuit is: "<<I<<endl;

cout<<endl;

else if(choice==2)

cout<<"enter current: "<<endl;

cin>>I;

cout<<"enter resistance: "<<endl;

cin>>R;
V=I*R;

cout<<"The voltage in the circuit is: "<<V<<endl;

cout<<endl;

else if(choice==3)

cout<<"enter voltage : "<<endl;

cin>>V;

cout<<"enter current: "<<endl;

cin>>I;

R=V/I;

cout<<"the resistance in the circuit is: "<<R<<endl;

cout<<endl;

else

cout<<"GOOD BYE..."<<endl;

return 0;

You might also like