SlideShare une entreprise Scribd logo
1  sur  24
The Programs
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
 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;
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
Code
#include<iostream.h>
#include<conio.h>
#include<math.h>
int main()
{
clrscr();
float number, power, answer;
cout<<"enter the number :- ";
cin>>number;
cout<<"enter the power of the number :- ";
cin>>power;
answer = pow (number,power);
cout<< number<<" raised to "<< power<<" is "<< answer;
getch();
return 0;
}
A quiz in C++
€ 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";
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
To determine whether the area of the given
rectangle is greater then it’s perimeter or not
 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;
}}
To determine the compound interest on
given amount for a given period and rate
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;
}}
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
σ 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;
}}
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
∏ Code
#include<iostream.h>#include<iostream.h>
#include<conio.h>#include<conio.h>
#include<math.h>#include<math.h>
#include<process.h>#include<process.h>
int main ()int main ()
{{
clrscr();clrscr();
int num, por;int num, por;
cout<<"Enter the number whose powers are to be listed";cout<<"Enter the number whose powers are to be listed";
cin>>num;cin>>num;
cout<<"enter the power till you want the powers to be listed";cout<<"enter the power till you want the powers to be listed";
cin>>por;cin>>por;
for ( int i = 1;i <= por; i++)for ( int i = 1;i <= por; i++)
cout << pow(num,i)<<"n";cout << pow(num,i)<<"n";
getch ();getch ();
return 0;return 0;
}}
To Know the money present in a
customer’s account at the end of specific
time. Given amount deposited and time
period
 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;
}
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
δ 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;
}
To know the amount of solar energy received
in the given area over a given period of time
Code
#include<iostream.h>
#include<conio.h>
int main ()
{
clrscr();
int t;
float ar,s;
float S = 1.4;
cout<<"enter area(mt. sq.), time (sec)";
cin>>ar>>t;
s = ar*t*60*1.4;
cout<<"solar energy recieved ="<<s<<"kJ";
getch();
return 0;
}
THANKTHANK
YOUYOU

Contenu connexe

En vedette

Object Oriented Program
Object Oriented ProgramObject Oriented Program
Object Oriented Program
Alisha Jain
 
C++ Function
C++ FunctionC++ Function
C++ Function
Hajar
 
Array in c language
Array in c languageArray in c language
Array in c language
home
 

En vedette (20)

Object Oriented Program
Object Oriented ProgramObject Oriented Program
Object Oriented Program
 
C++ arrays part2
C++ arrays part2C++ arrays part2
C++ arrays part2
 
C++11
C++11C++11
C++11
 
Flow control in c++
Flow control in c++Flow control in c++
Flow control in c++
 
C++ revision tour
C++ revision tourC++ revision tour
C++ revision tour
 
Flow of Control
Flow of ControlFlow of Control
Flow of Control
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Stacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti AroraStacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti Arora
 
Revision notes for exam 2011 computer science with C++
Revision notes for exam 2011 computer science with C++Revision notes for exam 2011 computer science with C++
Revision notes for exam 2011 computer science with C++
 
Flow of control ppt
Flow of control pptFlow of control ppt
Flow of control ppt
 
C++ classes
C++ classesC++ classes
C++ classes
 
C++ Function
C++ FunctionC++ Function
C++ Function
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
Arrays In C++
Arrays In C++Arrays In C++
Arrays In C++
 
functions of C++
functions of C++functions of C++
functions of C++
 
Data types
Data typesData types
Data types
 
Array in c language
Array in c languageArray in c language
Array in c language
 
Intro. to prog. c++
Intro. to prog. c++Intro. to prog. c++
Intro. to prog. c++
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
 

Similaire à C++ programming

Programming - Marla Fuentes
Programming - Marla FuentesProgramming - Marla Fuentes
Programming - Marla Fuentes
mfuentessss
 
Assignement of programming & problem solving
Assignement of programming & problem solvingAssignement of programming & problem solving
Assignement of programming & problem solving
Syed Umair
 
FP 201 Unit 3
FP 201 Unit 3 FP 201 Unit 3
FP 201 Unit 3
rohassanie
 

Similaire à C++ programming (20)

Project in programming
Project in programmingProject in programming
Project in programming
 
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
 
project
projectproject
project
 
Hospital management
Hospital managementHospital management
Hospital management
 
Hospital management
Hospital managementHospital management
Hospital management
 
Statement
StatementStatement
Statement
 
Oop1
Oop1Oop1
Oop1
 
Programación de C++, Función Case
Programación de C++, Función CaseProgramación de C++, Función Case
Programación de C++, Función Case
 
Programa Sumar y Multiplicar
Programa Sumar y MultiplicarPrograma Sumar y Multiplicar
Programa Sumar y Multiplicar
 
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docxEJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
 
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docxEJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
 
Laporan pd kelompok 6
Laporan pd kelompok 6Laporan pd kelompok 6
Laporan pd kelompok 6
 
C++ TUTORIAL 1
C++ TUTORIAL 1C++ TUTORIAL 1
C++ TUTORIAL 1
 
Programming - Marla Fuentes
Programming - Marla FuentesProgramming - Marla Fuentes
Programming - Marla Fuentes
 
Assignement of programming & problem solving
Assignement of programming & problem solvingAssignement of programming & problem solving
Assignement of programming & problem solving
 
FP 201 Unit 3
FP 201 Unit 3 FP 201 Unit 3
FP 201 Unit 3
 
10 template code program
10 template code program10 template code program
10 template code program
 
C++ file
C++ fileC++ file
C++ file
 
C++ file
C++ fileC++ file
C++ file
 
C++ file
C++ fileC++ file
C++ file
 

Plus de Pranav Ghildiyal

CBSE Class XII practical project on Rayon threads
CBSE Class XII practical project on Rayon threadsCBSE Class XII practical project on Rayon threads
CBSE Class XII practical project on Rayon threads
Pranav Ghildiyal
 

Plus de Pranav Ghildiyal (20)

Lasers
LasersLasers
Lasers
 
Global warming :- A PowerPoint Presentation
Global warming :- A PowerPoint PresentationGlobal warming :- A PowerPoint Presentation
Global warming :- A PowerPoint Presentation
 
A Report On Disaster Management
A Report On Disaster ManagementA Report On Disaster Management
A Report On Disaster Management
 
Recycle and reuse of everyday material
Recycle and reuse of everyday materialRecycle and reuse of everyday material
Recycle and reuse of everyday material
 
Word of the day (may)
Word of  the day (may)Word of  the day (may)
Word of the day (may)
 
Boost your knowledge
Boost your knowledgeBoost your knowledge
Boost your knowledge
 
CBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical fileCBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical file
 
CBSE Class XII physics practical project on Metal detector
CBSE Class XII physics practical project on Metal detectorCBSE Class XII physics practical project on Metal detector
CBSE Class XII physics practical project on Metal detector
 
CBSE Class XII practical project on Rayon threads
CBSE Class XII practical project on Rayon threadsCBSE Class XII practical project on Rayon threads
CBSE Class XII practical project on Rayon threads
 
Shopping mall
Shopping mallShopping mall
Shopping mall
 
CBSE Class X Rise of nationalism in europe
CBSE Class X Rise of nationalism in europeCBSE Class X Rise of nationalism in europe
CBSE Class X Rise of nationalism in europe
 
H1 n1 swine flu
H1 n1 swine fluH1 n1 swine flu
H1 n1 swine flu
 
CBSE Class IX Social Studies ECONOMICS Poverty as a challenge
CBSE Class IX Social Studies ECONOMICS Poverty as a challengeCBSE Class IX Social Studies ECONOMICS Poverty as a challenge
CBSE Class IX Social Studies ECONOMICS Poverty as a challenge
 
CBSE Class IX Sciense Physics Sound
CBSE Class IX Sciense Physics SoundCBSE Class IX Sciense Physics Sound
CBSE Class IX Sciense Physics Sound
 
CBSE Class IX Chemistry Natural resources
CBSE Class IX Chemistry Natural resourcesCBSE Class IX Chemistry Natural resources
CBSE Class IX Chemistry Natural resources
 
CBSE Class IX SCIENCE CHEMISTRY Is matter around us pure
CBSE Class IX SCIENCE CHEMISTRY Is matter around us pureCBSE Class IX SCIENCE CHEMISTRY Is matter around us pure
CBSE Class IX SCIENCE CHEMISTRY Is matter around us pure
 
CBSE Class X Chemical reactions and equations
CBSE Class X Chemical reactions and equationsCBSE Class X Chemical reactions and equations
CBSE Class X Chemical reactions and equations
 
CBSE Class XI Chemistry :- Organic chemistry (Basics)
CBSE Class XI Chemistry :- Organic chemistry (Basics)CBSE Class XI Chemistry :- Organic chemistry (Basics)
CBSE Class XI Chemistry :- Organic chemistry (Basics)
 
CBSE Class XI Maths Arthmetic progression
CBSE Class XI Maths Arthmetic progressionCBSE Class XI Maths Arthmetic progression
CBSE Class XI Maths Arthmetic progression
 
CBSE Class XI Maths Linear inequalities
CBSE Class XI Maths Linear inequalitiesCBSE Class XI Maths Linear inequalities
CBSE Class XI Maths Linear inequalities
 

Dernier

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
fonyou31
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Dernier (20)

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 

C++ programming

  • 1.
  • 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
  • 6. Code #include<iostream.h> #include<conio.h> #include<math.h> int main() { clrscr(); float number, power, answer; cout<<"enter the number :- "; cin>>number; cout<<"enter the power of the number :- "; cin>>power; answer = pow (number,power); cout<< number<<" raised to "<< power<<" is "<< answer; getch(); return 0; }
  • 7. A quiz in C++
  • 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
  • 17. ∏ Code #include<iostream.h>#include<iostream.h> #include<conio.h>#include<conio.h> #include<math.h>#include<math.h> #include<process.h>#include<process.h> int main ()int main () {{ clrscr();clrscr(); int num, por;int num, por; cout<<"Enter the number whose powers are to be listed";cout<<"Enter the number whose powers are to be listed"; cin>>num;cin>>num; cout<<"enter the power till you want the powers to be listed";cout<<"enter the power till you want the powers to be listed"; cin>>por;cin>>por; for ( int i = 1;i <= por; i++)for ( int i = 1;i <= por; i++) cout << pow(num,i)<<"n";cout << pow(num,i)<<"n"; getch ();getch (); return 0;return 0; }}
  • 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
  • 23. Code #include<iostream.h> #include<conio.h> int main () { clrscr(); int t; float ar,s; float S = 1.4; cout<<"enter area(mt. sq.), time (sec)"; cin>>ar>>t; s = ar*t*60*1.4; cout<<"solar energy recieved ="<<s<<"kJ"; getch(); return 0; }