SlideShare a Scribd company logo
Programming &ProblemSolving
1
/*Write a program that input two number interchange the value of and then display them
without using third variable.*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
cout<<"Entr 1st num : ";
cin>>a;
cout<<"Entr 2nd num : ";
cin>>b;
cout<<"Value Befor Swapping:"<<endl;
cout<<"1st num="<<a<<endl;
cout<<"2nd num="<<b<<endl;
a=a+b;
b=a-b;
a=a-b;
cout<<"Value After Swapping:"<<endl;
cout<<"1st num="<<a<<endl;
cout<<"2nd num="<<b<<endl;
getch();
}
Out Put
Programming &ProblemSolving
2
/*Take input of Three n.o if the are not Equal,then find the Smallest n.o*/
#include<iostream.h>
#include<conio.h>
void main(){
clrscr();
int a,b,c;
cout<<"Entr 1st n.o = ";
cin>>a;
cout<<"Entr 2nd n.o = ";
cin>>b;
cout<<"Entr 3rd n.o = ";
cin>>c;
if((a<b)&&(a<c))
cout<<"Smallest n.o is = "<<a;
else if((c<a) && (c<b)){
cout<<"Smallest n.o is = "<<c;}
else if((b<a) && (b<c)){
cout<<"Smallest n.o is = "<<b;}
else{
cout<<"All n.o are Equal";}
Programming &ProblemSolving
3
getch();
}
Out Put
/*Take input of two n.o if 1st n.o is greater than 2nd,display the division
as follow i.e. 1st=16 2nd=5 Ans=5*3+1=16*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n1,n2;
cout<<"Entr 1st no. = ";
cin>>n1;
cout<<"Entr 2nd no. = " ;
cin>>n2;
if(n2>n1)
{
cout<<"invalide input";
}
else
cout<<n2<<" * "<<n1/n2<<" + "<<n1%n2<<" = "<<n1<<"n";
getch();
Programming &ProblemSolving
4
}
Out Put
/*Show out
*****
*****
***** */
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j;
for(i=1;i<=3;i++)
{
for(j=1;j<=5;j++)
{
cout<<"*";
}
cout<<"n";
}
getch();
}
Programming &ProblemSolving
5
Out Put
/*Take input a n.o and find if it is divisible by 10 or not*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a;
cout<<"Entr any number = ";
cin>>a;
if(a%10==0)
{
cout<<"it is Divisible by 10";
}
else
{
cout<<"it is not Divisible by 10";
}
getch();
Programming &ProblemSolving
6
}
Out Put
/*entr 10 student age and show average age*/
#include <iostream.h>
#include<conio.h>
void main()
{
clrscr();
float age1,age2,age3,age4,age5,age6,age7,age8,age9,age10;
float TotalAge;
float AverageAge;
cout <<" Please Enter The Age Of Student 1:" ;
cin >> age1;
cout <<" Please Enter The Age Of Student 2:" ;
cin >> age2;
cout <<" Please Enter The Age Of Student 3:" ;
cin >> age3;
cout <<" Please Enter The Age Of Student 4:" ;
cin >> age4;
cout <<" Please Enter The Age Of Student 5:" ;
cin >> age5;
cout <<" Please Enter The Age Of Student 6:" ;
Programming &ProblemSolving
7
cin >> age6;
cout <<" Please Enter The Age Of Student 7:" ;
cin >> age7;
cout <<" Please Enter The Age Of Student 8:" ;
cin >> age8;
cout <<" Please Enter The Age Of Student 9:" ;
cin >> age9;
cout <<" Please Enter The Age Of Student 10:" ;
cin >> age10;
TotalAge=age1+age2+age3+age4+age5+age6+age7+age8+age9+age10;
AverageAge=TotalAge/10 ;
cout << " Average Age Of Class Is : " << AverageAge ;
getch();
}
Out Put
/*Show 1st 8 FIBONACCI Number */
#include<iostream.h>
#include<conio.h>
void main()
Programming &ProblemSolving
8
{
clrscr();
long int a=21,b=0,c=1,sum;
while(b<a)
{
cout<<c<<" ";
sum=b+c;
b=c;
c=sum;
}
getch();
}
Out Put
/* Show out
*
**
***
**** */
#include<iostream.h>
#include<conio.h>
void main()
Programming &ProblemSolving
9
{
clrscr();
int i,j,sp;
for(i=1;i<=4;i++){
for(sp=1;sp<=4-i;sp++)
{
cout<<" ";
}
for(j=1;j<=i;j++)
{
cout<<"*";}
cout<<"n";
}
getch();
}
Out Put
/*Triangle */
#include<iostream.h>
#include<conio.h>
Programming &ProblemSolving
10
void main() //if(i==1&&i==4&&j==1&&j==x)
{
clrscr();
int i,j,sp,x=1;
for(i=1;i<=4;i++,x=x+2)
{
for(sp=1;sp<=4-i;sp++) cout<<" ";
for(j=1;j<=x;j++)
{
if(i>1&&i<4&&j>1&&j<x)
cout<<" ";
else
cout<<"*";
}
cout<<"n";
}
getch();
}
Out Put
Programming &ProblemSolving
11
/*SUM OF 1ST 6TH PRIME NUMBER*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,sum=0,flag=1,x;
for(i=1,x=0;x<=5;i++)
{
for(j=2;j<=i/2;j++)
{
if(i%j==0)
{
flag=0;
break;
}
}
if(flag)
{
x++;
sum+=i;
cout<<i<<" + ";
}
Programming &ProblemSolving
12
else
{
flag=1;
}
}
cout<<"bb = "<<sum;
getch();}
Out Put
/*Enter The Amount Of The Bill And Discount At The Rate Of 10% */
#include <iostream.h>
#include<conio.h>
void main ()
{
clrscr();
double amount,discount,netpayable;
cout << " Please Enter The Amount Of The Bill ";
cin >> amount;
if(amount>5000)
{
discount = amount*(15.0/100);
netpayable = amount-discount;
cout <<" The Discount At The Rate Of 15 % is Rupees " << discount << endl;
Programming &ProblemSolving
13
cout << " The Payable Amount is Rupees " << netpayable;
}
else
{
discount = amount*(10.0/100);
netpayable = amount-discount;
cout <<" The Discount At The Rate Of 10 % is Rupees " << discount << endl;
cout << " The Payable Amount is Rupees " << netpayable;
}
getch();
}
Out Put
/*Show out
****
***
**
* */
#include<iostream.h>
#include<conio.h>
void main()
{
Programming &ProblemSolving
14
clrscr();
int i,j;
for(i=1;i<=4;i++)
{
for(j=i;j<=4;j++)
{
cout<<"*";
}
cout<<"n";
}
getch();
}
Out Put
/*Write a program that generates the following output using a single nested loop
$
##
$$$
#### */
#include<iostream.h>
#include<conio.h>
Programming &ProblemSolving
15
void main()
{
clrscr();
int i,j;
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++)
if(i%2==0)
cout<<"#";
else
cout<<"$";
cout<<"n";
}
getch();
}
Out Put

More Related Content

What's hot (20)

งานนำเสนอ อาจารย์ลาวัลย์
งานนำเสนอ อาจารย์ลาวัลย์งานนำเสนอ อาจารย์ลาวัลย์
งานนำเสนอ อาจารย์ลาวัลย์
 
C- Programs - Harsh
C- Programs - HarshC- Programs - Harsh
C- Programs - Harsh
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 
Stl algorithm-Basic types
Stl algorithm-Basic typesStl algorithm-Basic types
Stl algorithm-Basic types
 
Jarmo van de Seijp Shadbox ERC223
Jarmo van de Seijp Shadbox ERC223Jarmo van de Seijp Shadbox ERC223
Jarmo van de Seijp Shadbox ERC223
 
Assignment#1
Assignment#1Assignment#1
Assignment#1
 
C++ programs
C++ programsC++ programs
C++ programs
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 
c plus plus programsSlide
c plus plus programsSlidec plus plus programsSlide
c plus plus programsSlide
 
C++ Programming - 3rd Study
C++ Programming - 3rd StudyC++ Programming - 3rd Study
C++ Programming - 3rd Study
 
Tugas Program C++
Tugas Program C++Tugas Program C++
Tugas Program C++
 
Function basics
Function basicsFunction basics
Function basics
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Program Kasir c++(case ROti88)
Program Kasir c++(case ROti88)Program Kasir c++(case ROti88)
Program Kasir c++(case ROti88)
 
MFC Rect2
MFC Rect2MFC Rect2
MFC Rect2
 
C++ assignment
C++ assignmentC++ assignment
C++ assignment
 
1
11
1
 
Oopsprc1e
Oopsprc1eOopsprc1e
Oopsprc1e
 
basic programs in C++
basic programs in C++ basic programs in C++
basic programs in C++
 

Similar to Assignement of programming & problem solving

54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101premrings
 
Tugas praktikukm pemrograman c++
Tugas praktikukm  pemrograman c++Tugas praktikukm  pemrograman c++
Tugas praktikukm pemrograman c++Dendi Riadi
 
Laporan pd kelompok 6
Laporan pd kelompok 6Laporan pd kelompok 6
Laporan pd kelompok 6phoe3
 
c++ practical Digvajiya collage Rajnandgaon
c++ practical  Digvajiya collage Rajnandgaonc++ practical  Digvajiya collage Rajnandgaon
c++ practical Digvajiya collage Rajnandgaonyash production
 
Practiceproblems(1)
Practiceproblems(1)Practiceproblems(1)
Practiceproblems(1)Sena Nama
 
C101-PracticeProblems.pdf
C101-PracticeProblems.pdfC101-PracticeProblems.pdf
C101-PracticeProblems.pdfT17Rockstar
 
Solved Practice Problems For the C++ Exams
Solved Practice Problems For the C++ ExamsSolved Practice Problems For the C++ Exams
Solved Practice Problems For the C++ ExamsMuhammadTalha436
 
ch5_additional.ppt
ch5_additional.pptch5_additional.ppt
ch5_additional.pptLokeshK66
 

Similar to Assignement of programming & problem solving (20)

Project in programming
Project in programmingProject in programming
Project in programming
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
 
Tugas praktikukm pemrograman c++
Tugas praktikukm  pemrograman c++Tugas praktikukm  pemrograman c++
Tugas praktikukm pemrograman c++
 
C++ file
C++ fileC++ file
C++ file
 
Laporan pd kelompok 6
Laporan pd kelompok 6Laporan pd kelompok 6
Laporan pd kelompok 6
 
C++ practical
C++ practicalC++ practical
C++ practical
 
C++ TUTORIAL 3
C++ TUTORIAL 3C++ TUTORIAL 3
C++ TUTORIAL 3
 
C++ file
C++ fileC++ file
C++ file
 
C++ TUTORIAL 2
C++ TUTORIAL 2C++ TUTORIAL 2
C++ TUTORIAL 2
 
10 template code program
10 template code program10 template code program
10 template code program
 
I PUC CS Lab_programs
I PUC CS Lab_programsI PUC CS Lab_programs
I PUC CS Lab_programs
 
c++ practical Digvajiya collage Rajnandgaon
c++ practical  Digvajiya collage Rajnandgaonc++ practical  Digvajiya collage Rajnandgaon
c++ practical Digvajiya collage Rajnandgaon
 
Practiceproblems(1)
Practiceproblems(1)Practiceproblems(1)
Practiceproblems(1)
 
C101-PracticeProblems.pdf
C101-PracticeProblems.pdfC101-PracticeProblems.pdf
C101-PracticeProblems.pdf
 
Solved Practice Problems For the C++ Exams
Solved Practice Problems For the C++ ExamsSolved Practice Problems For the C++ Exams
Solved Practice Problems For the C++ Exams
 
ch5_additional.ppt
ch5_additional.pptch5_additional.ppt
ch5_additional.ppt
 
Statement
StatementStatement
Statement
 
C++ TUTORIAL 1
C++ TUTORIAL 1C++ TUTORIAL 1
C++ TUTORIAL 1
 
Ch7
Ch7Ch7
Ch7
 
Ch7
Ch7Ch7
Ch7
 

More from Syed Umair

More from Syed Umair (20)

Assignement code
Assignement codeAssignement code
Assignement code
 
Tree 4
Tree 4Tree 4
Tree 4
 
Title page
Title pageTitle page
Title page
 
S.k
S.kS.k
S.k
 
Q.a
Q.aQ.a
Q.a
 
Prog
ProgProg
Prog
 
Perception
PerceptionPerception
Perception
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
 
M.b
M.bM.b
M.b
 
C++ 4
C++ 4C++ 4
C++ 4
 
B.g
B.gB.g
B.g
 
Assignement of discrete mathematics
Assignement of discrete mathematicsAssignement of discrete mathematics
Assignement of discrete mathematics
 
A.i
A.iA.i
A.i
 
H m
H mH m
H m
 
Prog
ProgProg
Prog
 
Assignment c++12
Assignment c++12Assignment c++12
Assignment c++12
 
Assignement of discrete mathematics
Assignement of discrete mathematicsAssignement of discrete mathematics
Assignement of discrete mathematics
 
Assignement c++
Assignement c++Assignement c++
Assignement c++
 
Truth table a.r
Truth table a.rTruth table a.r
Truth table a.r
 

Recently uploaded

Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportAvinash Rai
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfTamralipta Mahavidyalaya
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfjoachimlavalley1
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfQucHHunhnh
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxssuserbdd3e8
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...Denish Jangid
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptxmansk2
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxbennyroshan06
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfbu07226
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online PresentationGDSCYCCE
 
Forest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFForest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFVivekanand Anglo Vedic Academy
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfPo-Chuan Chen
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resourcesaileywriter
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...Sayali Powar
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxDenish Jangid
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
 

Recently uploaded (20)

Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptx
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 
Forest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFForest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDF
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resources
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 

Assignement of programming & problem solving

  • 1. Programming &ProblemSolving 1 /*Write a program that input two number interchange the value of and then display them without using third variable.*/ #include<iostream.h> #include<conio.h> void main() { clrscr(); int a,b; cout<<"Entr 1st num : "; cin>>a; cout<<"Entr 2nd num : "; cin>>b; cout<<"Value Befor Swapping:"<<endl; cout<<"1st num="<<a<<endl; cout<<"2nd num="<<b<<endl; a=a+b; b=a-b; a=a-b; cout<<"Value After Swapping:"<<endl; cout<<"1st num="<<a<<endl; cout<<"2nd num="<<b<<endl; getch(); } Out Put
  • 2. Programming &ProblemSolving 2 /*Take input of Three n.o if the are not Equal,then find the Smallest n.o*/ #include<iostream.h> #include<conio.h> void main(){ clrscr(); int a,b,c; cout<<"Entr 1st n.o = "; cin>>a; cout<<"Entr 2nd n.o = "; cin>>b; cout<<"Entr 3rd n.o = "; cin>>c; if((a<b)&&(a<c)) cout<<"Smallest n.o is = "<<a; else if((c<a) && (c<b)){ cout<<"Smallest n.o is = "<<c;} else if((b<a) && (b<c)){ cout<<"Smallest n.o is = "<<b;} else{ cout<<"All n.o are Equal";}
  • 3. Programming &ProblemSolving 3 getch(); } Out Put /*Take input of two n.o if 1st n.o is greater than 2nd,display the division as follow i.e. 1st=16 2nd=5 Ans=5*3+1=16*/ #include<iostream.h> #include<conio.h> void main() { clrscr(); int n1,n2; cout<<"Entr 1st no. = "; cin>>n1; cout<<"Entr 2nd no. = " ; cin>>n2; if(n2>n1) { cout<<"invalide input"; } else cout<<n2<<" * "<<n1/n2<<" + "<<n1%n2<<" = "<<n1<<"n"; getch();
  • 4. Programming &ProblemSolving 4 } Out Put /*Show out ***** ***** ***** */ #include<iostream.h> #include<conio.h> void main() { clrscr(); int i,j; for(i=1;i<=3;i++) { for(j=1;j<=5;j++) { cout<<"*"; } cout<<"n"; } getch(); }
  • 5. Programming &ProblemSolving 5 Out Put /*Take input a n.o and find if it is divisible by 10 or not*/ #include<iostream.h> #include<conio.h> void main() { clrscr(); int a; cout<<"Entr any number = "; cin>>a; if(a%10==0) { cout<<"it is Divisible by 10"; } else { cout<<"it is not Divisible by 10"; } getch();
  • 6. Programming &ProblemSolving 6 } Out Put /*entr 10 student age and show average age*/ #include <iostream.h> #include<conio.h> void main() { clrscr(); float age1,age2,age3,age4,age5,age6,age7,age8,age9,age10; float TotalAge; float AverageAge; cout <<" Please Enter The Age Of Student 1:" ; cin >> age1; cout <<" Please Enter The Age Of Student 2:" ; cin >> age2; cout <<" Please Enter The Age Of Student 3:" ; cin >> age3; cout <<" Please Enter The Age Of Student 4:" ; cin >> age4; cout <<" Please Enter The Age Of Student 5:" ; cin >> age5; cout <<" Please Enter The Age Of Student 6:" ;
  • 7. Programming &ProblemSolving 7 cin >> age6; cout <<" Please Enter The Age Of Student 7:" ; cin >> age7; cout <<" Please Enter The Age Of Student 8:" ; cin >> age8; cout <<" Please Enter The Age Of Student 9:" ; cin >> age9; cout <<" Please Enter The Age Of Student 10:" ; cin >> age10; TotalAge=age1+age2+age3+age4+age5+age6+age7+age8+age9+age10; AverageAge=TotalAge/10 ; cout << " Average Age Of Class Is : " << AverageAge ; getch(); } Out Put /*Show 1st 8 FIBONACCI Number */ #include<iostream.h> #include<conio.h> void main()
  • 8. Programming &ProblemSolving 8 { clrscr(); long int a=21,b=0,c=1,sum; while(b<a) { cout<<c<<" "; sum=b+c; b=c; c=sum; } getch(); } Out Put /* Show out * ** *** **** */ #include<iostream.h> #include<conio.h> void main()
  • 9. Programming &ProblemSolving 9 { clrscr(); int i,j,sp; for(i=1;i<=4;i++){ for(sp=1;sp<=4-i;sp++) { cout<<" "; } for(j=1;j<=i;j++) { cout<<"*";} cout<<"n"; } getch(); } Out Put /*Triangle */ #include<iostream.h> #include<conio.h>
  • 10. Programming &ProblemSolving 10 void main() //if(i==1&&i==4&&j==1&&j==x) { clrscr(); int i,j,sp,x=1; for(i=1;i<=4;i++,x=x+2) { for(sp=1;sp<=4-i;sp++) cout<<" "; for(j=1;j<=x;j++) { if(i>1&&i<4&&j>1&&j<x) cout<<" "; else cout<<"*"; } cout<<"n"; } getch(); } Out Put
  • 11. Programming &ProblemSolving 11 /*SUM OF 1ST 6TH PRIME NUMBER*/ #include<iostream.h> #include<conio.h> void main() { clrscr(); int i,j,sum=0,flag=1,x; for(i=1,x=0;x<=5;i++) { for(j=2;j<=i/2;j++) { if(i%j==0) { flag=0; break; } } if(flag) { x++; sum+=i; cout<<i<<" + "; }
  • 12. Programming &ProblemSolving 12 else { flag=1; } } cout<<"bb = "<<sum; getch();} Out Put /*Enter The Amount Of The Bill And Discount At The Rate Of 10% */ #include <iostream.h> #include<conio.h> void main () { clrscr(); double amount,discount,netpayable; cout << " Please Enter The Amount Of The Bill "; cin >> amount; if(amount>5000) { discount = amount*(15.0/100); netpayable = amount-discount; cout <<" The Discount At The Rate Of 15 % is Rupees " << discount << endl;
  • 13. Programming &ProblemSolving 13 cout << " The Payable Amount is Rupees " << netpayable; } else { discount = amount*(10.0/100); netpayable = amount-discount; cout <<" The Discount At The Rate Of 10 % is Rupees " << discount << endl; cout << " The Payable Amount is Rupees " << netpayable; } getch(); } Out Put /*Show out **** *** ** * */ #include<iostream.h> #include<conio.h> void main() {
  • 14. Programming &ProblemSolving 14 clrscr(); int i,j; for(i=1;i<=4;i++) { for(j=i;j<=4;j++) { cout<<"*"; } cout<<"n"; } getch(); } Out Put /*Write a program that generates the following output using a single nested loop $ ## $$$ #### */ #include<iostream.h> #include<conio.h>
  • 15. Programming &ProblemSolving 15 void main() { clrscr(); int i,j; for(i=1;i<=4;i++) { for(j=1;j<=i;j++) if(i%2==0) cout<<"#"; else cout<<"$"; cout<<"n"; } getch(); } Out Put