Advertisement
Guest User

sranik

a guest
Oct 23rd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include <stdlib.h>
  4. using namespace std;
  5. int n = 10;
  6. int i;
  7. int main()
  8. {
  9. int tab[n];
  10. srand(time(0));
  11. cout<<"STARA TABLICA ";
  12. for(i = 0; i <= n; i++)
  13. {
  14. tab[i]=rand()%500;
  15. cout<<tab[i]<<", ";
  16. }
  17.  
  18. cout<<"\nNOWA TABLICA ";
  19. for(i = 0; i <= n; i++)
  20. {
  21. if(i%2!=0)
  22. {
  23. tab[i]=0;
  24. }
  25. cout<<tab[i]<<", ";
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement