Professional Documents
Culture Documents
Ex 2
#include<iostream>
using namespace std;
int main() {
int x;
do {
cin >> x;
} while (x <= 99 || x >=1000);
cout << x % 10 * 100 + x / 10 % 10 * 10 + x / 100;
Ex 4
#include<iostream>
using namespace std;
int main() {
int x;
do {
cin >> x;
} while (x < 1000|| x >9999);
cout << x / 1000 * 10 + x % 10;
}
Ex 5
#include<iostream>
using namespace std;
int main() {
int x;
do {
cin >> x;
} while (x < 1000|| x >9999);
cout << x % 1000 + x % 100 + x % 10;
}
Ex 6
#include<iostream>
using namespace std;
int main() {
float x,y;
do {
#include<iostream>
#include<cmath>
using namespace std;
int main() {
int xa,ya,xb,yb;
cin >> xa >> ya >> xb >> yb;
cout << sqrt((xb - xa) ^ 2 + (yb - ya) ^ 2);
}
Ex 8
#include<iostream>
using namespace std;
int main() {
int x, y, xa, ya, xb, yb;
cin >> xa >> ya >> xb >> yb;
x = (xa + xb) / 2;
y = (ya + yb) / 2;
cout << x << y;
}
Ex 9
#include<iostream>
#include<cmath>
using namespace std;
int main() {
int x, y, xa, ya, xb, yb, xc, yc, AB, BC, CA, p;
cin >> xa >> ya >> xb >> yb >> xc >> yc;
AB= sqrt((xb - xa) ^ 2 + (yb - ya) ^ 2);
BC= sqrt((xc - xb) ^ 2 + (yc - yb) ^ 2);
CA= sqrt((xc - xa) ^ 2 + (yc - ya) ^ 2);
p = (AB + BC + CA) / 2;
cout << "Perimetrul triunghiului este:" << AB + BC + CA << endl;
cout << "Aria triunghiului este:" << sqrt(p*(p - BC)*(p - CA)*(p - AB));
}
Variante
21.c
31.b
41.a
22.b
32.d
42.b
23.d
33.c
43.a
24.d
34.a
44.d
25.c
35.c
45.b
26.c
36.b
46.c
27.a
37.c
47.d
28.b
38.d
48.a
29.a
39.d
49.b
30.d
40.c
50.b