Source Codee
Source Codee
d= pow(b,2) -(4*a*c)
x1 = (-b+ sqrt(d))/(2*a)
x2 = (-b - sqrt(d))/(2*a)
If (a=0)
Write “This equation is linear please try again”
Else
If (d>0)
Write “Two real and district roots”
Write X1, X2
End if
If(d<0)
Write “Error the roots are complexed”
End if
End if
Question #3
Set n to 0
Set x[10] to {}
Set S to 125348
x[0]=6*pow(10,2)
do {x[n+1]=0.5*(x[n]+(s/x[n]));
n++}
while (x[n] != x[n-1])
Write “The square of S is
Write S
Write X[n]
Question #1
#include<iostream>
#include<math.h>
int main()
{
long double Io,T,V,I;
float q,k;
int cal;
q= 1.6*pow(10,-19);
k=1.38*pow(10,-23);
if (cal=1)
{
cout<<" enter the applied voltage,saturation current and the junction temperature
values\n";
cin>> V;
cin>> Io;
cin>>T;
I = Io*(exp((q*V)/(k*T))-1);
cout<<I<<endl;}
else if (cal=2)
{
cout<<" enter the applied voltage,net current and the junction temperature values\n";
cin>> V;
cin>> I;
cin>>T;
Io = I/(exp((q*V)/(k*T))-1);
cout<<Io<<endl;
else if(cal=3)
{
cout<<" enter the net current,net current and the junction temperature values\n";
cin>> I;
cin>> Io;
cin>>T;
V=((k*T)/q)*log((I/Io)+1);
cout<< V<<endl;
return 0;
}
Question #1
#include<iostream>
#include<math.h>
int main()
{
double a,b,c;
float x1,x2,d;
cout<< " the coefficients of your quadratic equation\n";
cin>>a;
cin>>b;
cin>>c;
d= pow(b,2) -(4*a*c);
x1 = (-b+ sqrt(d))/(2*a);
x2 = (-b - sqrt(d))/(2*a);
if(a==0)
{
cout<<" this equation is linear\n\n";
} else
{
if(d==0)
{
cout<<" repeated real number solution\n";
cout<<"first root is \n"<<x1 <<"\n the second root
is\n"<<x2<<"\n\n";
}
else
{
if(d>0)
{
cout<<" two real distinct number solution\n";
cout<<"first root is \n"<<x1 <<"\n the second root is\n"<<x2<<"\n\n";
}
else{
if(d<0)
{
cout<<" error!! these roots are complexed\n\n";
}
}
}
}
return 0;
}
Question #2
#include<iostream>
#include<math.h>
int main()
{
int n=0;
double x[10]={};
float s=125348;
x[0]=6*pow(10,2);
do
{
x[n+1]=0.5*(x[n]+(s/x[n]));
n++;
} while(x[n] != x[n-1]);
cout<< "the square of "<<s<<" is \n";
cout<< x[n];
return 0;
}