Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc;
- disp('Лабораторная работа №5');
- disp('Задание 1');
- for x=1:2:11
- y = sin(x)^3
- disp([x,y])
- end
- disp('****************************************')
- disp('Задание 2');
- s = 0;
- for x = 2:.5:8
- y = x^2+cos(x);
- s = s + y;
- end
- disp(s);
- disp('****************************************')
- disp('Задание 3');
- s = 0;
- k = 0;
- for x =1:.4:5
- y = 0.03*x^2-sin(x)*cos(5*x);
- if y < 0 then
- s = s+y;
- k = k+1;
- end
- end
- disp('Сумма:');
- disp(s)
- disp('Количество слагаемых:')
- disp(k)
- disp('******************************')
- disp('Задание 4');
- s=0;
- while s<7
- r = rand()
- if (0.2<r)& (0.7>r) then
- disp(' ', +string(r))
- s = s + r
- end
- end
- disp(string(s), "Значение суммы:")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement