Guest User

Untitled

a guest
Oct 16th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int x;
  9. int i = 1;
  10. int result;
  11. cout <<" Enter the value for n" << endl;
  12. cin >> x;
  13.  
  14. while (i >x)
  15. if (i%2 == 0) {}
  16.  
  17. else {
  18.  
  19. result += pow(i,3);
  20. i++;
  21. }
  22.  
  23. cout << "The sum of odd integers cubes from " << i << " to " << x << "= " << result << endl;
  24.  
  25.  
  26.  
  27. return 0;
  28.  
  29. }
Add Comment
Please, Sign In to add comment