Untitled
unknown
plain_text
a year ago
482 B
0
Indexable
Never
#include<iostream> using namespace std; int main(void){ int size; cout<<"Enter the size of the array : "; cin>>size; int arr[size]; for(int i=0;i<size;i++){ cout<<"Enter the number at index ["<<i<<"] : "; cin>>arr[i]; } for(int i=0;i<(size-1);i++){ for(int j=i+1;j<size;j++){ if(arr[i]>arr[j]){ int temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; } } } cout<<"Elements are : "; for(int i=0;i<size;i++){ cout<<arr[i]<<" "; } }