#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include <cmath>
using std::pow;
using std::sqrt;
double vpisannayaOkryzhnost(double);
double opisannayaOkryzhnost(double);
int main()
{
double perimeter;
cout << "Vvedite perimeter: ";
cin >> perimeter;
cout << "r vpisannoi okruzhnosti = " << vpisannayaOkryzhnost(perimeter) << endl;
cout << "R opisannoi okruzhnosti = " << opisannayaOkryzhnost(perimeter) << endl;
cin.get();
return 0;
}
double vpisannayaOkryzhnost(double perimeter)
{
double a = perimeter / 4;
return (a / 2);
}
double opisannayaOkryzhnost(double perimeter)
{
double a = perimeter / 4;
return (sqrt(2) / 2 * a);
}
На Гэ-паскале можно написать так:
program math;
var perimeter, a: real;
begin
write('Vvedite perimeter: ');
read(perimeter);
a := perimeter / 4;
writeln('r vpisannoi okruzhnosti = ', a / 2:0:2);
writeln('R opisannoi okruzhnosti = ', sqrt(2) / 2 * a:0:2);
readln();
readln();
end.
65*23*4=5980 символов всего.
N=16 симв. i = 4 бита
V = k × i = 23920 бит
program primer_1;
var a, b:integer;
begin
a:=10;
b:=2;
writeln('(a*a+b)*a/b=',(a*a+b)*a/b);
end.