Var
s:real;
n,i:integer;
a:array[1..1000] of real;
begin
write('Введите кол-во элементов: '); readln(n);
writeln('Введите элементы: ');
for i:=1 to n do
read(a[i]);
s:=0;
for i:=1 to n do
if odd(i) then s:=s+a[i];
writeln('Сумма: ',s);
end.
#include "math.h"
#include <stdlib.h>
#include "stdio.h"
#include "conio.h"
#include <iostream>
using namespace std;
int main()
{
using namespace std;
int N;
int count = 0;
setlocale(LC_ALL, "Russian");
cout << "Введите N : "; cin >> N;
for (int i = 0; i <= N; i++)
{
if (i % 5 == 0 && i!=0) count++;
}
cout << "Натуральных чисел,кратных 5-ти в данном ряду : "<< count;
cout << endl;
_getch();
}
вот ...................................
Надо смотреть монетор подальше от телевизора. Если смотреть близко можно испортить зрение.
Program kol_vo_elementov;
var a:array[1..10] of integer;
i, s:integer;
begin
for i:=1 to 10 do
begin
a[i]:=random(25);
write(a[i],' ');
if (a[i]>0) then
s:=s+a[i];
end;
writeln('s=',s);
end.