Program task1;
var n, S, k, i: integer;
begin
write('Кол-во чисел = ');
readln(n);
S := 0;
For i := 1 to n do
begin
write('Введите число ');
readln(k);
S := S + k
end;
writeln('Сумма введенных произвольных чисел = ', s);
end.
#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.
Var s,n:integer;
begin
repeat
readln(n);
if (n mod 3=0) and (n<10) then s:=s+n;
until n=0;
writeln('S=',s);
<span>end.</span>
Вот так, через логарифм:
exp(ln(a+1) / 3)