Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

#include <iostream> using namespace std; void main() { int a[50],n,b,c,i; cout<<" size of array : "; cin>>n; cout<<endl;

cout<<" value of array : "; for(i=0; i<n ;i++ ) { cin>>a[i] ; }

for (i=0;i<n;i++) { for(b=i+1;b<n;b++) { if(a[i]>a[b]) { c=a[i]; a[i]=a[b]; a[b]=c; } } }

cout<<endl; cout<<" \n The value of array in ascending order is = for( i=0 ; i<n ; i++ ) { cout<<"\t "<<a[i]; } cout<<endl; }

";

Screenshot:

You might also like