0% found this document useful (0 votes)
11 views

Practical 4 Data Structure

Uploaded by

Aneesh Shinde
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Practical 4 Data Structure

Uploaded by

Aneesh Shinde
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Name- Aakash Rao

Roll no.-16
Practical 4
Program- Sort element of array in descending order
#include<iostream>

using namespace std;

int main(){

int i,a[10],temp,j;

cout<<"Enter any 10 number in array: \n";

for(i=0;i<10;i++)

cin>>a[i];

cout<<"\n Data before shorting: ";

for(j=0;j<10;j++)

cout<<a[j];

for(i=0;i<=10;i++){

for(j=0;j<=10-i;i++){

if(a[j]>a[j+1]){

temp=a[j];

a[j]=a[j+1];

a[j+1]=temp;

}}}

cout<<"\n Data after sorting: ";

for(j=0;j<10;j++){

cout<<a[j];
}

You might also like