Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- int x;
- int i = 1;
- int result;
- cout <<" Enter the value for n" << endl;
- cin >> x;
- while (i >x)
- if (i%2 == 0) {}
- else {
- result += pow(i,3);
- i++;
- }
- cout << "The sum of odd integers cubes from " << i << " to " << x << "= " << result << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment