Скрин с результатом работы программы прикрепил.
var a:array[1..10] of integer;
b:array[1..10] of integer;
c:array[1..10] of integer;
i:integer;
begin
write ('Введите массив 1: ');
for i:=1 to 10 do
read (a[i]);
WRITELN;
write ('Введите массив 2: ');
for i:=1 to 10 do
read (b[i]);
WRITELN;
WRITELN;
write ('Массив 3: ');
for i:=1 to 10 do
begin
if i mod 2 <> 0 then c[i]:=b[i+1];
if i mod 2 = 0 then c[i]:=a[i-1];
write (c[i],' ');
end;
end.
1) потому что меняя масштаб растрового изображения, мы меняем количество пиклелей.
2) Потому что растровое изображение позволяет делать изображения большие по объёму
Var
r: longint;
begin
readln (r);
if (r mod 5) = 0 then write ('Кратно') else write ('Не кратно');
end.
#include <iostream>using namespace std; int main(){ setlocale(LC_ALL, "Russian"); int number=2, number_of_seats=20, full_number, all_people, number_of_standing=10, rashod_all_fuel, number_of_seats__procent, road, number_of_seats_procent, number_of_standing_procent, full_procent, pribl, doroga, coust_fuel, rashod_fuel; cout<<"Введи кількість поїздок"<<endl; cin>>road; full_number=number_of_seats+number_of_standing; full_procent=road*(full_number*0.5); number_of_seats_procent=road*(full_number*0.3); number_of_seats__procent=number_of_seats_procent*0.5; cout<<"Введи проїханий маршут в км"<<endl; cin>>doroga; cout<<"Вартість пального"<<endl; cin>>coust_fuel; cout<<"Расход бензина на 100 км"<<endl; cin>>rashod_fuel; rashod_all_fuel=(road*doroga)*(coust_fuel*rashod_fuel); all_people=number*(full_procent+number_of_seats_procent-number_of_seats__procent); cout<<"Вигода = "<<all_people<<" гривень"<<endl; cout<<"Вигода = "<<all_people-rashod_all_fuel<<" гривень"<<endl; return 0;}
<em>1. Современное, короткое и быстрое решение</em>
<em>// PascalABC.NET 3.2, сборка 1417 от 28.03.2017</em>
<em>// Внимание! Если программа не работает, обновите версию!</em>
begin
var a:=ArrRandom(16,-20,80); a.Println;
Writeln('S=',a.Where((x,i)->i.IsOdd).Sum)
end.
<u>Пример</u>
61 64 70 22 76 22 18 44 36 53 29 -9 42 -19 66 34
S=211
<em>2. А вот так все еще учат в большинстве школ (стиль образца 70-80х годов прошлого века)</em>
const
n=16;
var
i,s:integer;
a:array[1..n] of integer;
begin
Randomize;
s:=0;
for i:=1 to n do begin
a[i]:=Random(101)-20;
Write(a[i],' ');
if i mod 2=0 then s:=s+a[i]
end;
Writeln;
Writeln('S=',s)
end.