Pascal, строки Ввести число N и один символ сформировать строку, в которой символ повторяется N_раз.
Answers & Comments
A1dar
Var s, res: string; n, i: integer; begin write('Enter the number: '); readln(n); write('Enter the string: '); readln(s); res := ''; for i := 1 to n do res := res + s; write('The resulting string: ', res) end.
Example
Enter the number: 5 Enter the string: Five The resulting string: FiveFiveFiveFiveFive
Answers & Comments
s, res: string;
n, i: integer;
begin
write('Enter the number: ');
readln(n);
write('Enter the string: ');
readln(s);
res := '';
for i := 1 to n do
res := res + s;
write('The resulting string: ', res)
end.
Example
Enter the number: 5
Enter the string: Five
The resulting string: FiveFiveFiveFiveFive