[ create a new paste ] login | about

Link: http://codepad.org/U5W2kNS9    [ raw code | output | fork ]

C++, pasted on Mar 15:
#include<iostream.h>

int main(){

int i;
int r;
int v;
cout<<"Enter value of Current :"<<endl;
cin>>i;
cout<<"Enter value of Resistance :"<<endl;
cin>>r;
cout<<"Enter value of volatge :"<<endl;
cin>>v;
int p1=(i^2)*r;
int p2=(i*v);
int p3=(v^2)/r;
cout<<"The value of power is :";
if (v==0)
cout<<p1;
else if (r==0)
cout<<p2;
else if (i==0)
cout<<p3;
 
return 0;
}


Output:
1
2
3
4
Enter value of Current :
Enter value of Resistance :
Enter value of volatge :
The value of power is :


Create a new paste based on this one


Comments: