Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

1)

#include <iostream>

using namespace std;

int main ()

int N=1;

cout<<"N"<<"\tN*10"<<"\tN*100"<<"\tN*1000"<<endl;

while (N<6)

cout<<"N"<<"\t"<<N*10<<"\t"<<N*100<<"\t"<<N*1000<<endl;

N++;

2.

a)
#include<iostream>

using namespace std;

int main()

int n=1;

int sum=0;

while(n<=100)

{
sum+=n;

cout<<"\t"<<sum;

n++;

cout<<endl;

system("pause");

b)

#include<iostream>

using namespace std;

int main()

int n=1;

int sum=0;

while(n<=100)

sum+=(n*n);

cout<<"\t"<<sum;

n++;

cout<<endl;

system("pause");

}
c)

#include<iostream>

using namespace std;

int main()

int n=1;

int sum=0;

while(n<=100)

sum+=(n*n*n);

cout<<"\t"<<sum;

n++;

cout<<endl;

system("pause");

3)
#include <iostream>

#include <cmath>

using namespace std;

int main ()

int leg1 = 0;

int leg2 =0;

int total1 = 0;
int total2= 0;

cout<<"Enter Leg One:" <<endl;

cin>>leg1;

cout<<"Enter Leg Two"<<endl;

cin>>leg2;

total1 = pow(leg1,2)+pow(leg2,2);

total2 = sqrt(total1);

cout<<"The hypotenuse of right angle with sides of"<<leg1<<"and"<<leg2<<"is"<<total2<<endl;

system("pause");

return 0;

You might also like