1) A) This Programme Compares Which Number Is Larger Than The Other

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

1)a)this programme compares which number is larger than the other

#include <iostream>
using namespace std;

int main (void)

{
int num1=0.0;
int num2=0.0;

cout << "enter number"<<endl;


cin>>num1;
cout<< "enter second number"<<endl;
cin>>num2;

if (num1>num2)

cout<<" Larger to smaller number is:\t" <<num1 <<" \t"<< num2


<<endl;

else if (num2>num1)
cout <<" Larger to smaller number is:\t" << num2<<" \t"<< num1
<<endl;
system ("pause");

1b) # include <iostream>


using namespace std ;

int main ()

{
int a=1, b=1, c ;
if (c = (a-b))
cout << " The value of c is : " << c ;
return 0 ;

}
Q2)a)
#include <iostream>
using namespace std;
int main(void)

{
cout<<"enter your name"<<endl;
char name[10];
cin >> name;
cout << " Hello:\t " << name << endl;

system ("pause");

Q2)b)
#include <iostream>
using namespace std;

int main (void)

{
int N=0.0;
float X=0.0;
int total=0.0;

cout << "enter number"<<endl;


cin>>N;
cout <<"enter second number"<<endl;
cin>>X;
total=(N+X);

cout<< "The total of the numbers:"<<total<<endl<<endl;


system ("pause");

}
Q2)c)

#include <iostream>
using namespace std;

int main (void)

{
int inches=0.0;
double cm=0.0;

cout << "enter the length in inches"<<endl;


cin>>inches;
cm=(inches*2.5);

cout<< "The length in centimetres:" <<cm<<endl<<endl;


system ("pause");

}
Q3)

#include <iostream>
using namespace std;

int main (void)

{
double f;
double c;
int pi=3.14;
double Xc;

cout << "enter the frequency value"<<endl;


cin>>f;
cout <<"enter the capacitance value"<<endl;
cin>>c;

Xc= 1/(2*pi*c*f);

cout<< "The capacitive reactance:"<<Xc<<endl;


system ("pause");

You might also like