Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int a,b,c,d;
- cout << "Введите a,b,c,d: " << endl;
- cin >> a >> b >> c >> d;
- cout << "Числа на отрезка [a;b]: " << endl;
- for(int i=min(a,b);i<=max(a,b);i++){
- cout << i << " ";
- }
- cout << endl;
- int sum = 0;
- for(int i=min(b,c);i<=max(b,c);i++){
- sum+=i;
- }
- cout << "Сумма на отрезке [b;c]: " << sum << endl;
- int count = 0;
- for(int i=min(c,d);i<=max(c,d);i++){
- count+=i;
- }
- cout << "Среднее арифметическое на отрезке [c;d]: " << (float)count / abs(c-d)+1 << endl;
- int coun = 0;
- for(int i = min(a*c,b*d);i<=max(a*c,a*d);i++){
- if(i%3==0 && i>0){
- coun ++;
- }
- }
- cout << "Количество целых положительных чисел кратных трем на отрезке [axc;bxd]: ";
- cout << coun << endl;
- cout << "Первые 20 нечетныч чисел, больших a+b+c+d: " << endl;
- for(int i=a+b+c+d;i<=a+b+c+d+39;i++){
- if(i%2!=0){
- cout << i << " ";
- }
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment