等式“4□5=□9*5中的“□”是一个介于1~9之间的数字,用FOR ...NEXT语句

来源:百度知道 编辑:UC知道 时间:2024/05/24 03:12:30
等式“4□5=□9*5中的“□”是一个介于1~9之间的数字,用FOR ...NEXT语句
编写程序求"□"是多少(VB)

For i = 0 to 10
if ( 405+i*10 = ( i*10 + 9 ) * 5 ) then print i
end if
next i

Private Sub Form_click()
Dim i As Integer
For i = 1 To 9
If (405 + i * 10 = (i * 10 + 9) * 5) Then
Print 405 + i * 10; "="; i * 10 + 9; "* 5"
End If
Next
End Sub

#include<stdio.h>
main{
int i=0;
for(i=0;i++;i<=9)
{
if(4*100+i*10+5==(i*10+9)*5)
printf("所求的i=%d",i);
}
}