Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- //Задание 1
- int a, b, c;
- cout << "Введите значение a: ";
- cin >> a;
- cout << "Введите значение b: ";
- cin >> b;
- cout << "Введите значение c: ";
- cin >> c;
- const int P = a + b + c; //периметр
- int p = P / 2; //Полупериметр
- double geroninformula = p * (p - a) * (p - b) * (p - c); //Формула Герона
- double S = sqrt(geroninformula);
- cout << "Площадь треугольника с периметром " << P << " равна " << S << endl;
- //Задание 2
- int x;
- cout << "Введите x: ";
- cin >> x;
- double y = sqrt(3) * x - 2 * sin(x);
- cout << "Корень из 3 * " << x << " - 2 * sin " << x << " = " << y << endl;
- //Задание 3
- int c3;
- cout<<"Введите трехзначное число: ";
- cin >> c3;
- int f = c3 /100;
- int s = c3 /10 % 10;
- int t = c3 % 10;
- cout<<f+s+t<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement