Guest User

Untitled

a guest
Feb 13th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8. int x, n;
  9. cout<<"enter n";
  10. cin>>n;
  11.  
  12. int be =2;
  13. int s=0;
  14. int power = 2;
  15.  
  16. for(int i=0;i<n;i++){
  17. if(i%2==0){
  18. if(i==0){
  19.  
  20. cout<<"1";
  21.  
  22. }
  23. else{
  24.  
  25. cout<<"-X^"<<power<<"/"<<be;
  26. power++;
  27. be = be +2;
  28.  
  29. }
  30. }
  31. else{
  32.  
  33.  
  34.  
  35.  
  36.  
  37. cout<<"+X^"<<power<<"/"<<be;
  38. power++;
  39. be = be+2;
  40. }
  41. }
  42.  
  43.  
  44.  
  45. return 0;
  46. }
Add Comment
Please, Sign In to add comment