回 帖 发 新 帖 刷新版面

主题:用Qbasic求1+22+333+4444+55555+666666


1+22+333+4444+55555+666666



input n 'n大于1
a=1
sn=0
tn=0
for i=1 to n
tn=tn+a
sn=sn+tn*i
a=a*10
print tn*i;
next i
print sn

回复列表 (共23个回复)

11 楼

cls
input n
for i=1 to n:x=0
  for j=1 to i
    x=x*10+i
  next j
  y=y+x
next i
print y
end

12 楼

cls:input n
for i=1 to n:x=0
  for j=1 to i
    x=x*10+i
  next j
  y=y+x
next i
print y
end

13 楼

sn=0
for   i=1to 6
   an = (i/9)*(10^i-1)
   sn=sn+an
 next i
end

14 楼

sn=0:a=0
for i=1 to 6
   a=(i/9)*(10^i-1)
   sn =sn+a
next i
end

15 楼


sn=0:a=0
for i=1 to 6
   a=(i/9)*(10^i-1)
   sn =sn+a
next i
end 
[em9][em1]

16 楼

sn=0:a=0
for i=1 to 6
   a=(i/9)*(10^i-1)
   sn =sn+a
next i
end

17 楼

cls
sn=0:a=0
for i=1 to 6
   a=(i/9)*(10^i-1)
   sn =sn+a
next i
end

18 楼

cls
for i=1 to 6
s=s+val(string$(i,ltrim$(str$(i))))
next i
print s
end

19 楼

CLS
FOR I=1 TO 6
A$=LTRIM$(STR$(I))
B$=STRING$(I,A$)
A=A+VAL(B$)
NEXT I
PRINT A
END

20 楼


CLS
INPUT N
S = 0
FOR I = 1 TO N
  X = 0
  FOR J = 1 TO I
    X = X * 10 + I
  NEXT J
  S = S + X
NEXT I
PRINT S
END

我来回复

您尚未登录,请登录后再回复。点此登录或注册