Advertisement
Kacper_Michalak

Zadanie pętle 13

Dec 12th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x = 10, y = 0;
  7.     int i;
  8.     int z = x;
  9.     for (i = 0; i < x; i++)
  10.     {
  11.         y = y + (z * z);
  12.         z--;
  13.     }
  14.     cout << "Ilosc cegiel w piramidzie 10x10 wynosi: " << y << endl;
  15.    
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement