#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
int n,i,j;
cin>>n;
double arr[n];
for(i=0;i<n;i++)
{
cin>>arr[i];
}
for(i=0;i<n;i++)
{
for(j=(i+1);j<n;j++)
{
if(arr[i]>arr[j])
{
swap(arr[i],arr[j]);
}
}
}
for(i=0;i<n;i++)
{
cout<<fixed<<setprecision(0)<<arr[i]<<endl;
}
}
Input:
6
31415926535897932384626433832795
1
3
10
3
5
Output:
1
3
3
5
10
31415926535897932384626433832795
My Output:
1
3
3
5
10
31415926535897933290036940242944
This question is about big sorting problem of hacker rank. Though the logic is right but the data type is not supporting the value used.The value gets changed though i use double or long double or long long. Please tell me the reason for this in detail about the memory that is used by these two data type. Thank you for the answer.