clsinput "n"; ndim a(n)for i = 1 to n input "a"; a(i)nextfor i = 1 to n if a(i) / 2 < > int(a(i) / 2) then sum = sum + a(i) ^ 2 end ifnextprint sum
sharkova1443
29.08.2021
Перед комментом " {eto ! }" вобьешь уравнения uses crt,graphabc; const t = 100; n = 5; var i,j,i1,j1,mn: integer; var alpha: real; type colortype=integer; type point = record; x, y: integer; end; type point3d = record; x, y: integer; end; const lx = -100; ly = -100; lz = -100; procedure osi; begin setpenwidth(3); line(400,0,400,800); line(0,400,800,400); line(800,0,0,800); end; function to2dx(x,y,z: integer; phi: real): integer; var x1, y1, z1: integer; begin x1 : = trunc( x * cos(phi) - y * sin(phi) ); y1 : = trunc( x * sin(phi) + y * cos(phi) ); z1 : = z; to2dx : = 400 + y1 - trunc(0.3 * x1); end; function to2dy(x,y,z: integer; phi: real): integer; var x1, y1, z1: integer; begin x : = trunc( x * cos(phi) - y * sin(phi) ); y : = trunc( x * sin(phi) + y * cos(phi) ); z1 : = z; to2dy : = 400 - z + trunc(0.4 * x); end; procedure line3d(x,y,z,x1,y1,z1: integer; phi: real); begin line(to2dx(x,y,z, phi), to2dy(x,y,z, phi), to2dx(x1,y1,z1, phi), to2dy(x1,y1,z1, phi))end; procedure lineto3d(x1,y1,z1: integer; phi: real); begin lineto(to2dx(x1,y1,z1, phi),to2dy(x1,y1,z1, phi))end; procedure moveto3d(x1,y1,z1: integer; phi: real); begin moveto(to2dx(x1,y1,z1, phi),to2dy(x1,y1,z1, phi))end; procedure drawtriangle(x1, y1, z1, x2, y2, z2, x3, y3, z3 : integer; phi: real); var triangle : array[1..3] of point; var nx, ny, nz : real; var cs, s: real; begin triangle[1].x : = to2dx(x1, y1, z1, phi); triangle[1].y : = to2dy(x1, y1, z1, phi); triangle[2].x : = to2dx(x2, y2, z2, phi); triangle[2].y : = to2dy(x2, y2, z2, phi); triangle[3].x : = to2dx(x3, y3, z3, phi); triangle[3].y : = to2dy(x3, y3, z3, phi); x1 : = x3 - x1; y1 : = y3 - y1; z3 : = z3 - z1; x2 : = x3 - x2; y2 : = y3 - y2; z3 : = z3 - z2; nx : = y1 * z2 - y2 * z1; ny : = z1 * x2 - z2 * x1; nz : = x1 * y2 - x2 * y1; try cs : = abs( (nx * lx + ny * ly + nz * lz) / sqrt(nx*nx + ny*ny + nz*nz) / sqrt(lx*lx + ly*ly + lz*lz) ); setbrushcolor(rgb(trunc(100 * cs), trunc(100 * cs), trunc(100 * ; setpencolor(rgb(trunc(100 * cs), trunc(100 * cs), trunc(100 * ; polygon(triangle, 3); except end; end; procedure draw(f: function(x,y: real): real; color1: colortype; phi: real); beginsetpenwidth(1); setpencolor(color1); for j1: =-trunc(t/n) to trunc(t/n) dobeginj: =j1*n; moveto3d(j,-t,trunc(f(j,- phi); for i1: =-trunc(t/n) to trunc(t/n) dobegini: =i1*n; lineto3d(j,i,trunc(f(j, phi); end; end; for i1: =-trunc(t/n) to trunc(t/n) dobegini: =i1*n; moveto3d(-t,i,trunc(f(-t, phi); for j1: =-trunc(t/n) to trunc(t/n) dobeginj: =j1*n; lineto3d(j,i,trunc(f(j, phi); end; end; end; function p(x,y: real): real; var a: integer; begintryp: =sin((x * x - y * y) / 2000) * 50; {eto ! }except p: =1; end; end; beginlockdrawing; setwindowheight(800); setwindowwidth(800); alpha : = 0; while true dobeginclearwindow(); draw(p, rgb(255, 0, 0), alpha); redraw; alpha : = alpha - 0.03; delay(5); end; end.
goryavinan
29.08.2021
Program odnomernui_massuv; uses crt; var a: array[1..100] of integer; n,i,j,imin: byte; buf: integer; begin write('размер массива от 1 до 100 n='); readln(n); //ручной ввод массива writeln('вводим элементы массива a: '); for i: =1 to n do begin write('a[',i,']='); readln (a[i]); end; //вывод массива до изменения writeln('исходный массив a: '); for i: =1 to n do write (a[i]: 5); writeln; //поиск минимума в серии imin: =1; for i: =1 to n do if a[i]< a[imin] then imin: =i; writeln('imin=',imin); if imin> n-2 then write('элементов для сортировки нет! ') else begin for i: =imin+1 to n-1 do for j: =i+1 to n do if a[i]< a[j] then begin buf: =a[i]; a[i]: =a[j]; a[j]: =buf; end; writeln('элементы после минимального отсортированы по убыванию: '); for i: =1 to n do write(a[i],' '); end; end. проверь
Ответить на вопрос
Поделитесь своими знаниями, ответьте на вопрос:
Водномерном массиве из n натуральных чисел вычислить сумму квадратов всех нечетных чисел нужна программа написания на бэйсике. и блок схема.
clsinput "n"; ndim a(n)for i = 1 to n input "a"; a(i)nextfor i = 1 to n if a(i) / 2 < > int(a(i) / 2) then sum = sum + a(i) ^ 2 end ifnextprint sum