int main(int argc,char *argv[]){
int n,i,j
printf("Please enter a positive integer...\n")
scanf("%d",&n)
for(i=n,j=0i(j*=10)+=i%10,i/=10)
printf(j==n ? "Yes\n" : "No\n")
return 0
}
运行样例:
Private Function isxys(a) As BooleanIf a <1000 Or a >9999 Then
isxys = False
Else
t1 = Int(a / 1000) '取千位数
t2 = Int((a - t1 * 1000) / 100)
t3 = Int((a - t1 * 1000 - t2 * 100) / 10)
t4 = a - t1 * 1000 - t2 * 100 - t3 * 10
If t1 + t2 = t3 + t4 Then
isxys = True
Else
isxys = False
End If
End If
End Function
Private Sub Command1_Click()
s = 0
For i = Val(Text1.Text) To Val(Text2.Text)
If isxys(i) Then
List1.AddItem i
s = s + 1
End If
Next
Text3.Text = s
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
List1.Clear
Text1.SetFocus
End Sub
vb6.0代码
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)