Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <iostream>
- using namespace std;
- int n,a[100];
- int main(){
- int p,i;
- cin >> n;
- for(int i=1; i<=n; ++i)
- cin >> a[i];
- for( p=n;p>=1;p--)
- if(sqrt(a[p])==sqrt(a[p])){
- for( i=n;i>=p;--i)
- a[i+1] = a[i];
- n++;
- a[p] = sqrt(a[p]);
- }
- for( i=1;i<=n;++i)
- cout << a[i] << " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement