Var n,k7,k5,k3,k1,k:integer;
begin
write('n = ');
readln(n);
k7:=n div 7;
k5:=(n-k7*7) div 5;
k3:=(n-k7*7-k5*5) div 3;
k1:=n-k7*7-k5*5-k3*3;
writeln('k7 = ',k7,' k5 = ',k5,' k3 = ',k3,' k1 = ',k1);
writeln('k = ',k7+k5+k3+k1);
end.
Пример:
n = 20
k7 = 2 k5 = 1 k3 = 0 k1 = 1
k = 4