i try to solve this problem using convert array into string and using sort function to solve my problem but i get error so correct my code
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int arr[n];
int i = 0;
while(n > 0){
arr[i] = n;
n–;
i++;
}
string str;
for(int i: arr){
str += to_string(i);
}
sort(str.begin(), str.end());
cout<<str<<" ";
return 0;
}
