Advertisement
idsystems

CPP_Practica65_Nicomaco

Mar 14th, 2013
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. // Program: nicomaco.cc
  2. // Author:  Yoan Pinzon
  3. // Date:    Agosto 30, 2006
  4.  
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main(){
  10.    int n, s, k=1;
  11.  
  12.    cout << "Entre n: "; cin >> n;
  13.    for(int i=1; i<=n; i++){
  14.       s=0;
  15.       for(int j=1; j<=i; j++) {s+=k; k+=2;}
  16.       cout << i << "^3=" << s << (i==n?"":", ");
  17.    }
  18.  
  19.    return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement