PEPS-Practical_File
PEPS-Practical_File
Solving
Practical File
Bachel
or of Engineering
(Electr
ical Engineering)
SUBMITTED BY
Vardaan Palta
2410996645
SUBMITTED TO
Dr. Abhishilpa Nandini
A
ssistant Professor
UNIVERSITY, PUNJAB
Exercise 1.
Program :
#include <iostream>
using namespace std;
int main() {
cout << "Ohm's Law states that, At constant temperature, the electrical
current(I) "
"flowing through a fixed linear resistance(R) is directly proportional to "
"the voltage(V) applied across it." << endl;
return 0;
}
Output :
Exercise 2.
Program :
#include<iostream>
using namespace std;
int main(){
std::cout<<"wire size (AWG)\tcopper ampacity (amps)\n";
std::cout<<"---------------------------------------\n";
std::cout <<"14\t\t15\n";
std::cout <<"12\t\t20\n";
std::cout <<"10\t\t30\n";
std::cout <<"8\t\t45\n";
std::cout <<"6\t\t65\n";
return 0;
}
Output :
Exercise 3.
parallel circuit.
Program :
#include<iostream>
using namespace std;
int main(){
int R1 , R2 , R3;
int totalresistance;
char circuitType;
cout << "enter resistance R1 (in ohm): ";
cin >> R1;
cout << "enter resistance R2 (in ohm): ";
cin >> R2;
cout << "enter resistance R3 (in ohm): ";
cin >> R3;
cout << "enter the type of circuit ('S' for series, 'p' for parallel): ";
cin>>circuitType;
if (circuitType == 'S' || circuitType == 's') {
totalresistance = R1 + R2 + R3;
cout << "the total resistance of the series circuit is :" << totalresistance <<
"ohms" <<endl;
}else if (circuitType == 'P' || circuitType == 'p') {
totalresistance = 1.0/ ((1.0/R1 + 1.0/R2 + 1.0/R3));
cout << "total resistance of the parallel circuit is: " <<totalresistance<<
"ohms "<< endl;
} else {
cout << "invalid circuit type entered. please enter 'S' for series or 'P' for
parallel." << endl;
}
return 0;
}
Output :
Exercise 4.
Program :
#include<iostream>
using namespace std;
int main(){
float Resistance,Current,Voltage;
cout<<"Enter the resistance in ohms: ";
cin>>Resistance;
cout<<"Enter the current in amperes: ";
cin>>Current;
Voltage=Resistance*Current;
cout<<"The voltage is: "<<Voltage<<" volts";
return 0;
}
Output :
Exercise 5.
Program :
#include<iostream>
using namespace std;
int main(){
float Current,Resistance,Power;
cout<<"Enter the current in amperes: ";
cin>>Current;
cout<<"Enter the resistance in ohms: ";
cin>>Resistance;
Power=Current*Current*Resistance;
cout<<"The power is: "<<Power<<"watts"<<endl;
return 0;
}
Output :
Exercise 6.
Aim :Write a program to calculate RMS (Root
Mean Square) voltage from peak voltage using
Program :
#include <iostream>
using namespace std;
int main() {
float V_peak;
cout << "Enter the peak voltage (in volts): ";
cin >> V_peak;
float V_RMS = V_peak / sqrt(2);
cout << "The RMS voltage is: " << V_RMS << " volts" << endl;
return 0;
}
Output :
Exercise 7.
Program :
#include <iostream>
using namespace std;
int main() {
float R, C, frequency;
const float PI=3.14;
cout << "Enter the resistance (in ohms): ";
cin >> R;
cout << "Enter the capacitance (in farads): ";
cin >> C;
frequency = 1.0 / (2*PI*R*C);
cout << "The frequency of the RC circuit is: " << frequency << " Hz" << endl;
return 0;
}
Output :
Exercise 8.
capacitor circuit).
Program :
#include <iostream>
using namespace std;
int main() {
float L, C, frequency;
const float PI=3.14;
cout << "Enter the inductance (in henries): ";
cin >> L;
cout << "Enter the capacitance (in farads): ";
cin >> C;
frequency = 1 / (2*PI*sqrt(L * C));
cout << "The resonant frequency of the LC circuit is: " << frequency << " Hz" <<
endl;
return 0;
}
Output :
Exercise 9.
Program :
#include <iostream>
using namespace std;
int main() {
float omega, frequency;
const float PI=3.14;
cout << "Enter the angular frequency (in radians per second): ";
cin >> omega;
frequency = omega / (2 * PI);
cout << "The frequency of the AC voltage signal is: " << frequency << " Hz" <<
endl;
return 0;
}
Output :
Exercise 10.
Output :
Exercise 11.
imaginary or equal
Program :
#include<iostream>
using namespace std;
int main(){
float a,b,c,d;
d=((b*b)-4*a*c);
cout<<"enter the value of (a):";
cin>>a;
cout<<"enter the value of (b):";
cin>>b;
cout<<"enter the value of (c):";
cin>>c;
if (d>0){
cout<<"the roots are real and distinct";
}else if (d==0){
cout<<"the roots are equal";
}else {
cout<<"the roots are imaginary";
}
return 0;
}
Output :
Exercise 12.
Program :
OUTPUT-
Exercise 13.
OUTPUT-
Exercise 15.
Program :
OUTPUT-
Exercise 14.
temperature.
Program :
Output :
Exercise 16.
Output :
Exercise 17.
Aim :Write a program using cascading if and else if statements
to determine the speed level of a motor based on RPM
Program :
Output :
Exercise 18.
statement.
Program :
OUTPUT-
Exercise 19.
Program :
OUTPUT-
Exercise 20.
Program :
OUTPUT-
Exercise 21.
Program :
OUTPUT-
Exercise 22.
V(t)=Vmax × (1-e-t/RC)
Program :
OUTPUT-
Exercise 23.
Program :
OUTPUT-
Exercise 24.
Program :
OUTPUT-
Exercise 25.
Program :
OUTPUT-
Exercise 26.
Program :
OUTPUT-
Exercise 27.
Program :
OUTPUT-
Exercise 28.
Program :
OUTPUT-