如图
2 回答
扬帆大鱼
TA贡献1799条经验 获得超9个赞
public static void main(String[] args) {
//定义变量3个整数型变量b,c,d
int b;
int c;
int d = 0; //给d赋值为0
for (int a = 1; a < 100; a++) { //for循环1-99
b = a / 10; //取十位
c = a % 10; //取给位
//if循环判断符合(a - 36 == c * 10 + b)的数
if (a - 36 == c * 10 + b) {
d = d + 1; //每次循环中符合时,d+1
}
}
System.out.println("一共有" + d + "个这样的特殊字的两位自然数。");
}这可能是你想要的效果吧,你的代码错的太凌乱。 代码如果报错就把注释删掉。
添加回答
举报
0/150
提交
取消
