Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 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. int min=liczba;
  14.  
  15. cout << "Podaj liczbe z przedzialu [2,500] i podzielna przez 2" << endl;
  16. cin>>liczba;
  17. if(liczba>=2 && liczba<=500 && liczba % 2==0)
  18. {
  19. cout<<"Podaj ile liczb jest : "<<endl;
  20. cin>>ile;
  21. for(int i=0; i<ile; i++)
  22. {
  23. cout<<"Podaj : "<<i+1<<" liczbe"<<endl;
  24. cin>>n[i];
  25. if(n[i]%3==0)
  26. {
  27. y[i]=n[i];
  28. suma = suma + y[i];
  29.  
  30. }
  31. if(n[i]<min)
  32. {
  33. min=n[i];
  34. }
  35.  
  36. }
  37.  
  38. cout<<"suma liczb podzielnych przez 3 rowna sie : "<<suma<<endl;
  39. cout<<"najmniejsza liczba to : "<<min<<endl;
  40. }
  41. else
  42. {
  43. cout<<"liczba nie nalezy do przdzialu"<<endl;
  44. }
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement