Program nalko; uses crt; const n = 10; var a:array [1..n] of real; i,k:integer; begin writeln('*** alphaues is thinking... ***'); writeln('*** OK ***'); Randomize; {ввод чисел} for i:=1 to n do begin write('Введите ',i,'-е число '); readln (a[i]) end; writeln('Корни и квадраты: '); for i:=1 to n do begin write('A[',i,']=',a[i]:7:2,' корень'); if a[i]<0 then write(' не существует') else write('=',sqrt(a[i]):7:2); writeln(' квадрат=',a[i]*a[i]:7:2); end; end.
#include<iostream> #include<cmath> #include<stdio.h> using namespace std; int main(){ int *arr = 0, r; int const N = 5; arr = new int [N]; cout << "enter arr : " << endl; for(int i = 0; i < N ; i++) cin >> arr[i]; for(int i = 0; i < N ; i++){ r = sqrt(arr[i]); cout << "arr[" << i << "] = " << r << endl; } }
Program nalko;
uses crt;
const n = 10;
var
a:array [1..n] of real;
i,k:integer;
begin
writeln('*** alphaues is thinking... ***');
writeln('*** OK ***');
Randomize;
{ввод чисел}
for i:=1 to n do
begin
write('Введите ',i,'-е число '); readln (a[i])
end;
writeln('Корни и квадраты: ');
for i:=1 to n do
begin
write('A[',i,']=',a[i]:7:2,' корень');
if a[i]<0
then write(' не существует')
else write('=',sqrt(a[i]):7:2);
writeln(' квадрат=',a[i]*a[i]:7:2);
end;
end.
как то так на С++
#include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;
int main(){
int *arr = 0, r;
int const N = 5;
arr = new int [N];
cout << "enter arr : " << endl;
for(int i = 0; i < N ; i++)
cin >> arr[i];
for(int i = 0; i < N ; i++){
r = sqrt(arr[i]);
cout << "arr[" << i << "] = " << r << endl;
}
}