fork download
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main( int argc, char * argv[] )
  7. {
  8. int tab1[ 8 ];
  9. int i;
  10. cout << "Podaj 8 liczb calkowitych" << endl;
  11. for( i = 0; i < 8; i++ ) {
  12. cin >> tab1[ i ];
  13. }
  14.  
  15. int kwadrat = 1;
  16. system( "cls" );
  17. cout << "Wpisales elementy: ";
  18. for( i = 0; i < 8; i++ ) {
  19. cout << tab1[ i ] << ",";
  20. }
  21. cout << "\n" << endl;
  22. cout << "Liczby, ktore przy dzieleniu przez 4 daja reszte 2 lub sa niedodatnie to: ";
  23. for( i = 0; i < 8; i++ ) {
  24. if( tab1[ i ] % 4 == 2 || tab1[ i ] < 0 ) {
  25. cout << tab1[ i ] << ",";
  26. }
  27. }
  28. cout << "\n" << endl;
  29. cout << "Kwadraty tych elementow to: ";
  30. for( i = 0; i < 8; i++ ) {
  31. if( tab1[ i ] % 4 == 2 || tab1[ i ] < 0 ) {
  32. kwadrat = tab1[ i ] * tab1[ i ];
  33. cout << kwadrat << ",";
  34. }
  35. }
  36.  
  37. cout << "\n" << endl;
  38. system( "PAUSE" );
  39. return EXIT_SUCCESS;
  40. }
Success #stdin #stdout #stderr 0s 3300KB
stdin
1
2
3
4
5
6
7
8
9
10
stdout
Podaj 8 liczb calkowitych
Wpisales elementy: 1,2,3,4,5,6,7,8,

Liczby, ktore przy dzieleniu przez 4 daja reszte 2 lub sa niedodatnie to: 2,6,

Kwadraty tych elementow to: 4,36,

stderr
sh: cls: not found
sh: PAUSE: not found