#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double r, s, c;
cin >> r;
s = M_PI*r*r;
c = 2*M_PI*r;
cout.setf(ios::fixed);
cout.precision(3);
cout << s << "\n" << c << "\n";
return 0;
}
Пример:
5
<span>78.540
31.416</span>
1)
Var
x,y:real;
begin
read(x);
y:=(3+exp(x))/cos(x)-1/abs(sqr(x)-0.2*x);
writeln(y);
end.
2)
Var
x,y:real;
begin
read(x);
if x<=3 then y:=sqr(x)-3*x+9 else y:=1/(power(x,3)+6);
writeln(y);
end.
3)
Var
p,i:integer;
begin
p:=1;
for i:=9 to 16 do //рассматривается вариант с до 17, а не по 17
if odd(i) then p:=p*i;
writeln(p);
end.
Текстовый редактор,<span>Текстовый процессор</span>
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <math.h>
using namespace std;
int main(int argc, char *argv[])
{
int n;
cin >>n;
int *a=new int[n]; /*Динамический массив из n элементов*/
srand(time(0));
double r=0;
for(int i=0;i<n; ++i)
{
a[i]=rand()%38 - 5;
r+=pow((sqrt(fabs(a[i]))-a[i]),2);
}
cout <<r<<endl;
delete [] a;
system("pause");
return EXIT_SUCCESS;
}