Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int liczba;
  8. int n[1000];
  9. int y[1000];
  10. int max=liczba;
  11. int suma=0;
  12. int ile;
  13.  
  14. cout << "Podaj liczbe z przedzialu [2,500] i podzielna przez 2" << endl;
  15. cin>>liczba;
  16. if(liczba>=2 && liczba<=500 && liczba % 2==0)
  17. {
  18. cout<<"Podaj ile liczb jest : "<<endl;
  19. cin>>ile;
  20. for(int i=0; i<ile; i++)
  21. {
  22. cout<<"Podaj :"<<i+1<<" liczbe"<<endl;
  23. cin>>n[i];
  24. if(n[i]%3==0)
  25. {
  26. n[i]=y[i];
  27. suma = suma + y[i];
  28.  
  29. }
  30.  
  31. }
  32.  
  33. cout<<"suma liczb podzielnych przez 3 rowna sie : "<<suma<<endl;
  34. }
  35. else
  36. {
  37. cout<<"liczba nie nalezy do przdzialu"<<endl;
  38. }
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement