Advertisement
STANAANDREY

8/4/2019

Apr 8th, 2019
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8. float v[1000],res,p_int,p_zec;
  9. unsigned n,i,st,dr;
  10.  
  11. cout<<"n=";cin>>n;
  12. for (i=0;i<n*2;i++)
  13. cin>>v[i];
  14. st=0;dr=2*n-1;
  15. while (st<dr)
  16. {
  17.     v[dr]=abs(v[dr]);
  18.     v[st]=abs(v[st]);
  19.     p_int=(int)v[st];
  20.     p_zec=v[dr]-(int)v[dr];
  21.     res=p_int+p_zec;
  22.     st++;
  23.     dr--;
  24.     cout<<res<<' ';
  25. }//*/
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement