//Dev-C++ 5.11(С)
#include <stdio.h>
int main(void)
{int n,i,f;
float sr,ar[100];
scanf("\%d",&n);
i=0;
f=0;
while(i<n)
{scanf("\%d",&ar[i]);
sr=sr+ar[i];
i++;}
sr=sr/n;
i=0;
while(i<n)
{if(ar[i]<sr)f++;
i++;}
printf("\%d",f);
return 0;
}
Пример ввода:
5
1
2
3
4
5
Пример вывода:
2
procedure p(x:integer; var st:string);
type
name = array[0..9] of String[50];
const
s1 : name = (' ноль ',' один ',' два ',' три ',' четыре ',' пять ',' шесть ',' семь ',' восемь ',' девять ');
s2: name = (' ',' десять ',' двадцать ',' тридцать ',' сорок ',' пятьдесят ',' шестьдесят ',' семьдесят ',' восемьдесят ',' девяносто ');
s3: name = (' ',' сто ',' двести ',' триста ',' четыреста ',' пятьсот ',' шестьсот ',' семьсот ',' восемьсот ',' девятьсот ');
s4 : name = (' ',' одиннадцать ',' двенадцать ',' тринадцать ',' четырнадцать ',' пятнадцать ',' шестнадцать ',' семнадцать ',' восемнадцать ',' девятнадцать ');
var
s,d,e : Integer;
begin
s:= x div 100; x:=x mod 100;
st:=s3[s];
d:= x div 10; e:=x mod 10;
if (d=1) and (e<>0) then st:=st+s4[e]
else st:=st+s2[d]+s1[e];
end;
var x:integer; st:string;
Begin
Write('Введите число [0..999] :');
Readln(x);
p(x,st);
writeln(st);
End.
Пример:
<span>Введите число [0..999] : 714
семьсот четырнадцать</span>
Да, дело в цикле. Там он специально настроен на этот пункт. Замените его на
for i := 1 to n do
for j := i to n do
if (i+j>n) then sum := sum + a[i, j];
И все заработает. Надеюсь, Вам можно применять ветвления. Циклом я отбираю пункт Б, и ветвлением отбираю пункт Г. Их слиянием как раз и есть пункт К.
subroutine SumSer(eps, res)
real eps
real(8) res
real(8) :: sgn = -1, z = 1, a
integer :: i = 1
res = 0
do
z = z * (2 * i) * ( 2 * i - 1)
a = sgn / z
if (abs(a) <= eps) then
exit
endif
res = res + a
sgn = -sgn
i = i + 1
enddo
end subroutine SumSer
program MainProg
real :: eps = 0.00001
real(8) y
call SumSer(eps, y)
write(*,'(1X,F9.6)') y
end program MainProg