Advertisement
Guest User

gowns

a guest
Dec 5th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. int main(int argc, char *argv[]){
  7. int n;
  8. cout << "Podaj ilosc elementow..." << endl;
  9. cin >> n;
  10. int tab[n];
  11.  
  12. int sum = 0;
  13.  
  14. for(int i = 0; i < n; i++){
  15. cout << "Podaj wartosc " << i+1 << "-ego elementu" << endl;
  16. cin >> tab[i];
  17. }
  18. for(int i = 0; i < n; i++){
  19. if(tab[i]%7 == 0){
  20. sum ++;
  21. }
  22. }
  23. cout << endl << "Suma elementow podzielnych przez 7: " << sum << endl;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement