evcamels

plot

Dec 2nd, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <cmath>
  4. using namespace std;
  5. int main() {
  6. int a,b,c,d;
  7. cout << "Введите a,b,c,d: " << endl;
  8. cin >> a >> b >> c >> d;
  9. cout << "Числа на отрезка [a;b]: " << endl;
  10. for(int i=min(a,b);i<=max(a,b);i++){
  11. cout << i << " ";
  12. }
  13. cout << endl;
  14. int sum = 0;
  15. for(int i=min(b,c);i<=max(b,c);i++){
  16. sum+=i;
  17. }
  18. cout << "Сумма на отрезке [b;c]: " << sum << endl;
  19. int count = 0;
  20. for(int i=min(c,d);i<=max(c,d);i++){
  21. count+=i;
  22. }
  23. cout << "Среднее арифметическое на отрезке [c;d]: " << (float)count / abs(c-d)+1 << endl;
  24. int coun = 0;
  25. for(int i = min(a*c,b*d);i<=max(a*c,a*d);i++){
  26. if(i%3==0 && i>0){
  27. coun ++;
  28. }
  29. }
  30. cout << "Количество целых положительных чисел кратных трем на отрезке [axc;bxd]: ";
  31. cout << coun << endl;
  32. cout << "Первые 20 нечетныч чисел, больших a+b+c+d: " << endl;
  33. for(int i=a+b+c+d;i<=a+b+c+d+39;i++){
  34. if(i%2!=0){
  35. cout << i << " ";
  36. }
  37. }
  38. cout << endl;
  39. return 0;
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment