Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Program 12345;
var num, ans, x : integer;
begin
writeln('Number of terms?');
readln(num);
x := 1;
ans := 0;
while num > 1 do
begin
ans := ans + x;
x := x*10+1;
num := num-1;
end;
writeln('answer is ', x);
end.
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more