SlideShare ist ein Scribd-Unternehmen logo
1 von 4
Introduction to Programming
1
//write a program to accept N number and arrange them in a ascending order
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,a,n,num[30];
cout<<"Entr any length n";
cin>>n;
cout<<"Entr the any number n";
for(i=0;i<n;++i)
cin>>num[i];
for(i=0;i<n;++i)
{
for(j=i+1;j<n;++j)
{
if(num[i]>num[j])
{
a=num[i];
num[i]=num[j];
num[j]=a;
}
}
}
cout<<"The number Arranged is Ascending Order are Given BelOwn" ;
for(i=0;i<n;++i)
cout<<"n"<< num[i];
getch();
Introduction to Programming
2
OUTPUT
//write a program to accept N number and arrange them in a Descending order
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,a,n,num[30];
cout<<"Entr Any Length n";
cin>>n;
cout<<"EntR ThE AnY NumBer n";
for(i=0;i<n;++i)
cin>>num[i];
for(i=0;i<n;++i)
{
Introduction to Programming
3
for(j=i+1;j<n;++j)
{
if(num[i]<num[j])
{
a=num[i];
num[i]=num[j];
num[j]=a;
}
}
}
cout<<"The number Arranged is Descending Order are Given BelOwn" ;
for(i=0;i<n;++i)
cout<<"n"<< num[i];
getch();
}
OUTPUT
Introduction to Programming
4
/*Write a program that takes input in an
array of size and reverse it*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int arr[6];
for(int i=0;i<6;i++)
{
cout<<"EntR aNy NuMbEr = :n";
cin>>arr[i];
}
cout<<"iN aCtUaL 0rdEr :.n";
for(i=0;i<6;i++)
cout<<arr[i]<<"n";
cout<<"In ReVErSe OrDeR :.n";
for(i=6;i>=0;i--)
cout<<arr[i]<<"n";
getch();
}
OUTPUT

Weitere ähnliche Inhalte

Was ist angesagt?

Assignement of programming & problem solving(3)a.z
Assignement of programming & problem solving(3)a.zAssignement of programming & problem solving(3)a.z
Assignement of programming & problem solving(3)a.z
Syed Umair
 

Was ist angesagt? (15)

Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3
 
PROGRAM FOR INSERTION SORTING IN ARRAY
PROGRAM FOR INSERTION SORTING IN ARRAY PROGRAM FOR INSERTION SORTING IN ARRAY
PROGRAM FOR INSERTION SORTING IN ARRAY
 
C program to add n numbers
C program to add n numbers C program to add n numbers
C program to add n numbers
 
Cpp programs
Cpp programsCpp programs
Cpp programs
 
Code
CodeCode
Code
 
Bcsl 033 data and file structures lab s2-3
Bcsl 033 data and file structures lab s2-3Bcsl 033 data and file structures lab s2-3
Bcsl 033 data and file structures lab s2-3
 
Document
DocumentDocument
Document
 
Shan
ShanShan
Shan
 
Implement a queue using two stacks.
Implement a queue using two stacks.Implement a queue using two stacks.
Implement a queue using two stacks.
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
cosc 281 hw2
cosc 281 hw2cosc 281 hw2
cosc 281 hw2
 
Palindrome number program c
Palindrome number program cPalindrome number program c
Palindrome number program c
 
Assignement of programming & problem solving(3)a.z
Assignement of programming & problem solving(3)a.zAssignement of programming & problem solving(3)a.z
Assignement of programming & problem solving(3)a.z
 
Add digits of number in c
Add digits of number in c Add digits of number in c
Add digits of number in c
 
Bcsl 033 data and file structures lab s2-1
Bcsl 033 data and file structures lab s2-1Bcsl 033 data and file structures lab s2-1
Bcsl 033 data and file structures lab s2-1
 

Andere mochten auch

2011 05 Hr Nuts And Bolts Flyer
2011 05 Hr Nuts And Bolts Flyer2011 05 Hr Nuts And Bolts Flyer
2011 05 Hr Nuts And Bolts Flyer
yourpotential
 
Tp 4 analicis pagina seguros
Tp 4 analicis pagina segurosTp 4 analicis pagina seguros
Tp 4 analicis pagina seguros
itouzon
 
Como financiar la creación de mi plan de
Como financiar la creación de  mi plan deComo financiar la creación de  mi plan de
Como financiar la creación de mi plan de
eventossusini
 
Tailgas recycle compressor model
Tailgas recycle compressor modelTailgas recycle compressor model
Tailgas recycle compressor model
Mark Posey
 
Xét tuyển ngành dược bằng học bạ thpt
Xét tuyển ngành dược bằng học bạ thptXét tuyển ngành dược bằng học bạ thpt
Xét tuyển ngành dược bằng học bạ thpt
tuyen sinh lien thong
 
La usaid y el useximbank
La usaid y el useximbankLa usaid y el useximbank
La usaid y el useximbank
Lizeth Pedraza
 
La enfermedad mental en tratamiento penitenciario y la resocializacion
La enfermedad mental en tratamiento penitenciario y la resocializacion La enfermedad mental en tratamiento penitenciario y la resocializacion
La enfermedad mental en tratamiento penitenciario y la resocializacion
cleu
 

Andere mochten auch (17)

Web del colegio nicolas esguerra proyecto
Web del colegio nicolas esguerra proyectoWeb del colegio nicolas esguerra proyecto
Web del colegio nicolas esguerra proyecto
 
2011 05 Hr Nuts And Bolts Flyer
2011 05 Hr Nuts And Bolts Flyer2011 05 Hr Nuts And Bolts Flyer
2011 05 Hr Nuts And Bolts Flyer
 
Tp 4 analicis pagina seguros
Tp 4 analicis pagina segurosTp 4 analicis pagina seguros
Tp 4 analicis pagina seguros
 
Presentaciòn hernán villela
Presentaciòn hernán villelaPresentaciòn hernán villela
Presentaciòn hernán villela
 
Presentacion Del Tema
Presentacion Del TemaPresentacion Del Tema
Presentacion Del Tema
 
Alumno Ismael aprendizaje autónomo.
Alumno Ismael aprendizaje autónomo.Alumno Ismael aprendizaje autónomo.
Alumno Ismael aprendizaje autónomo.
 
Detailed Analysis
Detailed AnalysisDetailed Analysis
Detailed Analysis
 
Como financiar la creación de mi plan de
Como financiar la creación de  mi plan deComo financiar la creación de  mi plan de
Como financiar la creación de mi plan de
 
Ficha curso marca personal
Ficha curso marca personalFicha curso marca personal
Ficha curso marca personal
 
Tailgas recycle compressor model
Tailgas recycle compressor modelTailgas recycle compressor model
Tailgas recycle compressor model
 
Xét tuyển ngành dược bằng học bạ thpt
Xét tuyển ngành dược bằng học bạ thptXét tuyển ngành dược bằng học bạ thpt
Xét tuyển ngành dược bằng học bạ thpt
 
Docepruebasasterix
DocepruebasasterixDocepruebasasterix
Docepruebasasterix
 
3
33
3
 
La usaid y el useximbank
La usaid y el useximbankLa usaid y el useximbank
La usaid y el useximbank
 
La enfermedad mental en tratamiento penitenciario y la resocializacion
La enfermedad mental en tratamiento penitenciario y la resocializacion La enfermedad mental en tratamiento penitenciario y la resocializacion
La enfermedad mental en tratamiento penitenciario y la resocializacion
 
Checklist Basics For Trusts &amp; Estates
Checklist Basics For Trusts &amp; EstatesChecklist Basics For Trusts &amp; Estates
Checklist Basics For Trusts &amp; Estates
 
Lotteria
LotteriaLotteria
Lotteria
 

Ähnlich wie C++ 4

1 borland c++ 5.02 by aramse
1   borland c++ 5.02 by aramse1   borland c++ 5.02 by aramse
1 borland c++ 5.02 by aramse
Aram SE
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
HIMANSUKUMAR12
 

Ähnlich wie C++ 4 (20)

1 borland c++ 5.02 by aramse
1   borland c++ 5.02 by aramse1   borland c++ 5.02 by aramse
1 borland c++ 5.02 by aramse
 
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
 
Bijender (1)
Bijender (1)Bijender (1)
Bijender (1)
 
C++ file
C++ fileC++ file
C++ file
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
 
Assignment no 5
Assignment no 5Assignment no 5
Assignment no 5
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical file
 
Cpp c++ 1
Cpp c++ 1Cpp c++ 1
Cpp c++ 1
 
C++ file
C++ fileC++ file
C++ file
 
C++ file
C++ fileC++ file
C++ file
 
c plus plus programsSlide
c plus plus programsSlidec plus plus programsSlide
c plus plus programsSlide
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
 
C Programming
C ProgrammingC Programming
C Programming
 
Ds program-print
Ds program-printDs program-print
Ds program-print
 
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfPCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdf
 
PCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docxPCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docx
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
Unix Programs
Unix ProgramsUnix Programs
Unix Programs
 
C programming
C programmingC programming
C programming
 
C lab
C labC lab
C lab
 

Mehr von 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
 
B.g
B.gB.g
B.g
 
Assignement of programming & problem solving
Assignement of programming & problem solvingAssignement of programming & problem solving
Assignement of programming & problem solving
 
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
 

Kürzlich hochgeladen

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Kürzlich hochgeladen (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

C++ 4

  • 1. Introduction to Programming 1 //write a program to accept N number and arrange them in a ascending order #include<iostream.h> #include<conio.h> void main() { clrscr(); int i,j,a,n,num[30]; cout<<"Entr any length n"; cin>>n; cout<<"Entr the any number n"; for(i=0;i<n;++i) cin>>num[i]; for(i=0;i<n;++i) { for(j=i+1;j<n;++j) { if(num[i]>num[j]) { a=num[i]; num[i]=num[j]; num[j]=a; } } } cout<<"The number Arranged is Ascending Order are Given BelOwn" ; for(i=0;i<n;++i) cout<<"n"<< num[i]; getch();
  • 2. Introduction to Programming 2 OUTPUT //write a program to accept N number and arrange them in a Descending order #include<iostream.h> #include<conio.h> void main() { clrscr(); int i,j,a,n,num[30]; cout<<"Entr Any Length n"; cin>>n; cout<<"EntR ThE AnY NumBer n"; for(i=0;i<n;++i) cin>>num[i]; for(i=0;i<n;++i) {
  • 3. Introduction to Programming 3 for(j=i+1;j<n;++j) { if(num[i]<num[j]) { a=num[i]; num[i]=num[j]; num[j]=a; } } } cout<<"The number Arranged is Descending Order are Given BelOwn" ; for(i=0;i<n;++i) cout<<"n"<< num[i]; getch(); } OUTPUT
  • 4. Introduction to Programming 4 /*Write a program that takes input in an array of size and reverse it*/ #include<iostream.h> #include<conio.h> void main() { clrscr(); int arr[6]; for(int i=0;i<6;i++) { cout<<"EntR aNy NuMbEr = :n"; cin>>arr[i]; } cout<<"iN aCtUaL 0rdEr :.n"; for(i=0;i<6;i++) cout<<arr[i]<<"n"; cout<<"In ReVErSe OrDeR :.n"; for(i=6;i>=0;i--) cout<<arr[i]<<"n"; getch(); } OUTPUT