Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Program: nicomaco.cc
- // Author: Yoan Pinzon
- // Date: Agosto 30, 2006
- #include <iostream>
- using namespace std;
- int main(){
- int n, s, k=1;
- cout << "Entre n: "; cin >> n;
- for(int i=1; i<=n; i++){
- s=0;
- for(int j=1; j<=i; j++) {s+=k; k+=2;}
- cout << i << "^3=" << s << (i==n?"":", ");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement