package com.kangning.web.test;
import java.util.Scanner;
/**
* 从键盘上输入一个正整数,按数字的相反顺序输出
*/
public class PositiveIntegerReverse {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int m = sc.nextInt();
int sum = 0;
int n;
while (m != 0 && m % 10!=0) {
n = m % 10;
m = m / 10;
sum = sum * 10 + n;
}
System.out.println(sum);
}
}
/**
* 写一条for语句,计数条件为n从100~200,步长为2;然后再用while语句实现同样的循环。
*/
public class CircleTest {
public static void main(String[] args) {
//for循环
for (int n = 100; n < 200; n = n + 2) {
System.out.println(n);
}
}
}
<