Вариант в Excel 2003
Формулы в строке формул.
Program primer;
Var i,n,k,chislo:integer;
Begin
cls;
write(' skolko chisel budem vvodit ? '); readln(n);
write('chislo dlia poiska : '); read(k);
for i:=1 to n do
begin
readln(chislo);
if ((chislo mod 10 = k) or (chislo div 10 = k)) then
write('chislo ',chislo,' udov uslovie.. ')
else write('chislo ',chislo,' NE udov uslovie.. ');
writeln;
end;
readln;
End.
<span>import java.util.Scanner<span>;
</span>
public class NegSum {
public static void main(String[] args) {
Scanner in = new Scanner(System.in)<span>;
</span> int n = in.nextInt()<span>;
</span> int[] h = new int[n]<span>;
</span> int sum = 0<span>;
</span> for(int i = 0; i < n; i++) {
h[i] = in.nextInt()<span>;
</span> sum += h[i] < 0 ? i+1 : 0<span>;
</span> }
System.out.println(sum)<span>;
</span> }
}
</span>