#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
int n,v[101],s=0;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>v[i];
s+=v[i];
}
int ok=true;
for(int d=2;d<=sqrt(s);d++)
if(s%d==0)
ok=false;
if(ok){
for(int i=1;i<=n;i++)
cout<<v[i]<<" ";
sort(v,v+n+1);
cout<<endl;
for(int i=1;i<=n;i++)
cout<<v[i]<<" ";
}
else{
cout<<"Suma elementelor nu este un numar prim";
}
}
Sper ca asta trebuia, daca nu...spune ca modific