fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int ile_pol(int n) {
  5. return n * n;
  6.  
  7. }
  8. int ile_kolorowych(int n, char kolor) {
  9. if (kolor== 'b')
  10. return n * n / 2;
  11. else
  12. return (n * n -1) / 2+1;
  13. }
  14. int main() {
  15.  
  16. for (int i=2; i<=10; i++)
  17. cout <<i << ile_pol(i) <<ile_kolorowych(i, 'b') <<
  18. ile_kolorowych(i, 'c') <<endl;
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
2422
3945
41688
5251213
6361818
7492425
8643232
9814041
101005050