3. S. No. To Find Given
1. nth term
When
first term, common
difference,value of n
Is Given
2. Sum of n terms
3. Arithematic
Mean
enter first term,
common
difference,value of n
4. n if nth term is
given
enter first term,
common difference,
Enter nth term
5. n if sum of n
term is given
enter first term,
common difference,
sum of n terms
4. Code#include<iostream.h>
#include<conio.h>
#include<math.h>
int main()
{
clrscr();
int ch;
float a,nth,n,d,s,AM,i,j;
cout<<"n";
cout <<"Choice Menu"<<"n";
cout<<"n";
cout<<"1. nth term"<<"n";
cout<<"2. Sum of n terms"<<"n";
cout<<"3. Arithematic Mean"<<"n";
cout<<"4. n if nth term is given"<<"n";
cout<<"5. n if sum of n term is given"<<"n";
cin>>ch;
switch(ch)
{
case 1 : cout<<"enter first term, common difference,value of n";
cin>>a>>d>>n;
nth = a + (n-1)*d;
cout<<"the nth term is"<<nth<<"n";
break;
case 2 : cout<<"enter first term, common difference,value of
n";
cin>>a>>d>>n;
s = n/2*((a+a) +(n -1))*d;
cout<<"the sum is "<<s;
break;
case 3 : cout<<"enter first term, common diff.,value of n";
cin>>a>>d>>n;
nth = a + (n-1)*d;
AM = (a + nth)/2;
cout<<"the AM is"<<nth<<"n";
break;
case 4 : cout<<"enter first term, common difference, Enter nth
term";
cin>>a>>d>>nth;
n = (nth - a + d)/d;
cout<<"the value of n is " <<n;
break;
case 5 : float b,c,e,f,g,h,i,m;
cout<<"enter first term, common difference, Enter sum of n
term";
cin>>a>>d>>s;
h= (d -(2*a));
b =(-((2*a)- d));
c = pow(h,2.0);
e = (8*d*s);
g =(c+e);
f =sqrt(g);
n =(b + f)/2*d ;
i =(b - f)/2*d ;
if (i < 0)
cout<<"the value of n is " <<n;
else
cout<<"the value of n is " <<n<<"or"<<m;
break;
}
getch ();
return 0;
5. The resultant value when a number is given with
the power to which it has to be raised for any
given number
For Eg :- 5 raise to 3 is 125
8. € Code
#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
int IQ, ch1,ch2, ch3, ch4;
int pnt = 0;
cout<<"Qs.1)In how many ways cane we rename a file
"<<"n";
cout<<"1.1 way "<<"n";
cout<<"2.3 ways "<<"n";
cout<<"3.5 ways "<<"n";
cout<<"4.Can't say ";
cin>>ch1;
if (ch1==2)
{
pnt =(pnt + 3);
cout<<"correct Answer.............";
}
else
cout<<"wrong Answer...............";
cout<<"n";
cout<<"Qs. 2) fullstop is a valid character for filename in
Win Xp. What about its validity in Win 7 "<<"n";
cout<<"1.Valid "<<"n";
cout<<"2.Unvalid "<<"n";
cin>>ch2;
if (ch2==2)
{
pnt =(pnt + 3);
cout<<"correct Answer..............";
}
else
cout<<"wrong Answer................";
cout <<pnt;
cout<<"n";
cout<<"Qs.3)The inventing country of supercomputer PACE
is "<<"n";
cout<<"1.India "<<"n";
cout<<"2.China "<<"n";
cout<<"3.Japan "<<"n";
cin>>ch3;
if (ch3==1)
{
pnt =(pnt + 3);
cout<<"correct Answer.............";
}
else
cout<<"wrong Answer...............";
cout<<"n";
9. cout<<"Qs.4)Uninitialized variable will give as outputcout<<"Qs.4)Uninitialized variable will give as output
"<<"n";"<<"n";
cout<<"1.Garbage Value "<<"n";cout<<"1.Garbage Value "<<"n";
cout<<"2.zero "<<"n";cout<<"2.zero "<<"n";
cout<<"3.No output "<<"n";cout<<"3.No output "<<"n";
cin>>ch4;cin>>ch4;
if (ch4==1)if (ch4==1)
{{
pnt =(pnt + 3);pnt =(pnt + 3);
cout<<"correct Answer.............";cout<<"correct Answer.............";
}}
elseelse
cout<<"wrong Answer...............";cout<<"wrong Answer...............";
cout<<"n";cout<<"n";
IQ = pnt/3;IQ = pnt/3;
cout<<"please Wait"<<"n";cout<<"please Wait"<<"n";
cout<<"Generating Result"<<"n";cout<<"Generating Result"<<"n";
cout<< "you Answered "<<IQ<<" question correctly";cout<< "you Answered "<<IQ<<" question correctly";
cout<<" your score is:- "<< pnt;cout<<" your score is:- "<< pnt;
getch();getch();
return 0;return 0;
}}
€ Code continued
10. To determine whether the area of the given
rectangle is greater then it’s perimeter or not
11. Code
#include<iostream.h>#include<iostream.h>
#include<conio.h>#include<conio.h>
int main ()int main ()
{{
clrscr();clrscr();
float l,b, p, a;float l,b, p, a;
cout<<"enter length, bredth of the rectangle";cout<<"enter length, bredth of the rectangle";
cin>>l>>b;cin>>l>>b;
p = 2* (l +b);p = 2* (l +b);
a = l*b;a = l*b;
if (a >p)if (a >p)
cout <<"the area is greater then the permeter"<<"n";cout <<"the area is greater then the permeter"<<"n";
elseelse
cout<<"the area is smaller then the perimeter"<<"n";cout<<"the area is smaller then the perimeter"<<"n";
cout<<"perimeter :-"<<p<<"n";cout<<"perimeter :-"<<p<<"n";
cout<<"area :-"<<a;cout<<"area :-"<<a;
getch();getch();
return 0;return 0;
}}
12. To determine the compound interest on
given amount for a given period and rate
13. Code
#include <iostream.h>#include <iostream.h>
#include<conio.h>#include<conio.h>
#include<math.h>#include<math.h>
int main()int main()
{{
clrscr();clrscr();
float P,R,N,A,H,B;float P,R,N,A,H,B;
cout<<"Enter Principle Amount: ";cout<<"Enter Principle Amount: ";
cin>> P;cin>> P;
cout<<"Enter Rate of Interest: ";cout<<"Enter Rate of Interest: ";
cin>> R;cin>> R;
cout<<"Enter Time Period (in years): ";cout<<"Enter Time Period (in years): ";
cin>>N;cin>>N;
H = (1 + R/100);H = (1 + R/100);
B = pow (H,N);B = pow (H,N);
A = (P*B);A = (P*B);
cout<<"Principle Amout Rs."<<P<<"n";cout<<"Principle Amout Rs."<<P<<"n";
cout<<"Rate of Interest "<<R<<" %"<<"n";cout<<"Rate of Interest "<<R<<" %"<<"n";
cout<<"Time Period "<<N<<" years"<<"n";cout<<"Time Period "<<N<<" years"<<"n";
cout<<"the compoud interest for the given amount is Rs."<<A;cout<<"the compoud interest for the given amount is Rs."<<A;
getch();getch();
return 0;return 0;
}}
14. To determine the Quotient and RemainderTo determine the Quotient and Remainder
when a given number is divided by anotherwhen a given number is divided by another
given numbergiven number
15. σ CodeCode
#include <iostream.h>#include <iostream.h>
#include<conio.h>#include<conio.h>
int main ()int main ()
{{
clrscr();clrscr();
int a,div,b,num;int a,div,b,num;
cout<<"enter the number to be divided";cout<<"enter the number to be divided";
cin>>num;cin>>num;
cout<<"enter the number by which "<<num<<" has to be divided";cout<<"enter the number by which "<<num<<" has to be divided";
cin>>div;cin>>div;
a = num/div;a = num/div;
b = num%div;b = num%div;
cout<<num<<" divided by "<<div<<" gives "<<"n";cout<<num<<" divided by "<<div<<" gives "<<"n";
cout <<"quotient as "<<a<<"n";cout <<"quotient as "<<a<<"n";
cout <<"remainder as "<<b;cout <<"remainder as "<<b;
getch();getch();
return 0;return 0;
}}
16. To determine the result when a givenTo determine the result when a given
number is raised to all numbers from 1 tonumber is raised to all numbers from 1 to
the given valuethe given value
18. To Know the money present in a
customer’s account at the end of specific
time. Given amount deposited and time
period
19. Code
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<process.h>
int main ()
{
clrscr();
float amt, rt, A, H, B;
int yrs,ch;
cout<<"enter amount deposited";
cin>>amt;
cout<<"number of years";
cin>>yrs;
cout<<"n";
cout<<"choose most appropriate option about your amonut and time
period"<<"n";
cout<<"1. amout less than 2000, yrs more than 1"<<"n";
cout<<"2. amout between 2000 and 6000,yrs more than or equal to 1 "<<"n";
cout<<"3. amout more than 6000, yrs more than or equal to 1"<<"n";
cout<<"4. yrs more than or equal to 5"<<"n";
cout<<"5. none of the above ";
cin>>ch;
switch(ch)
{
case 1:rt =5;
break;
case 2:rt =7;
break;
case 3:rt =8;
break;
case 4:rt =10;
break;
case 5:rt = 3;
break;
}
H = (1 + rt/100);
B = pow( H, yrs);
A = (amt * B);
cout <<" the C. I for the "<<A;
getch();
return 0;
}
20. To find the entered amount’s value in another
country’s currency
Serial no.Serial no. Amount entered inAmount entered in Resulting amount inResulting amount in
11 INRINR US $US $
22 US $US $ INRINR
33 INRINR EuroEuro
44 EuroEuro INRINR
55 INRINR YenYen
66 YenYen INRINR
21. δ Code
#include<iostream.h>
#include<conio.h>
#include<process.h>
int main()
{
clrscr();
int ch;
float inri, inra, usdi, usda,inrie, inrae,euri,
eura,inriy,inray,yeni,yena;
cout<<"Choose from and to (currency)"<<"n";
cout<<"1.INR to US $"<<"n";
cout<<"2.US $ to INR"<<"n";
cout<<"3.INR to Euro"<<"n";
cout<<"4.Euro to INR"<<"n";
cout<<"5.INR to Yen "<<"n";
cout<<"6.Yen to INR "<<"n";
cin>>ch;
switch(ch)
{
case 1:cout<<"Enter amount in INR(Indian National
Rupee) :-";
cin>>inri;
inra = (inri/53);
cout<<inri<<" rupees are equal to "<<inra<<" US $"<<"n";
break;
case 2:cout<<"Enter amount in US $ (US dollars) :-";
cin>>usdi;
usda = (usdi * 53);
cout<<usdi<<" US $ are equal to "<<usda<<"Indian rupees
"<<"n";
break;
case 3:cout<<"Enter amount in INR(Indian National Rupee) :-";
cin>>inrie;
inrae = (inrie/70);
cout<<inrie<<" rupees are equal to "<<inra<<" Euro's"<<"n";
break;
case 4:cout<<"Enter amount in Euro's :-";
cin>>euri;
eura = (euri * 70);
cout<<euri<<" Euor's are equal to "<<eura<<"Indian rupees
"<<"n";
break;
case 5:cout<<"Enter amount in INR(Indian National Rupee) :-";
cin>>inriy;
inray = (inriy*1.4);
cout<<inriy<<" rupees are equal to "<<inra<<" Yen"<<"n";
break;
case 6:cout<<"Enter amount in Yen's :-";
cin>>yeni;
yena = (yeni/1.4);
cout<<inri<<" Yen are equal to "<<inra<<" Indian rupees"<<"n";
break;
}
getch();
return 0;
}
22. To know the amount of solar energy received
in the given area over a given period of time