编程语言
首页 > 编程语言> > java – 以相反的顺序打印数字的数字

java – 以相反的顺序打印数字的数字

作者:互联网

有人可以帮我解决这个问题吗?数字应该是可变的而不是常数.
输出应该是:

Timestamping In 6 Digit
8
5
6
3
0
1
Average In 6 Digit
9
8
7
6
5
2
class Timestamp1 extends Average1
{
  public static void main (String args[]) {

    int i = 103658;
    int j = 10;
    int k = i % j;
    System.out.println(" Timestamping In 6 Digit " );
    System.out.println(" " + k);

    int o = 10365;
    int p = 10;
    int q = o % p;
    System.out.println(" " + q);

    int l = 1036;
    int m = 10;
    int n = l % m;
    System.out.println(" " + n);

    int r = 103;
    int s = 10;
    int t = r % s;
    System.out.println(" " + t);

    int u = 10;
    int v = 10;
    int w = u % v;
    System.out.println(" " + w);

    int x = 1;
    int y = 10;
    int z = x % y;
    System.out.println(" " + z);




class Average1 extends Timestamp1 {

  public void main() {

    int i = 256789;
    int j = 10;
    int k = i % j;
    System.out.println(" Average In 6 Digit ");
    System.out.println(" " + k);

    int o = 25678;
    int p = 10;
    int q = o % p;
    System.out.println(" " + q);

    int l = 2567;
    int m = 10;
    int n = l % m;
    System.out.println(" " + n);

    int r = 256;
    int s = 10;
    int t = r % s;
    System.out.println(" " + t);

    int u = 25;
    int v = 10;
    int w = u % v;
    System.out.println(" " + w);

    int x = 2;
    int y = 10;
    int z = x % y;
    System.out.println(" " + z);
  }


}
}
}

解决方法:

如果你只是想扭转一个数字,那么你去吧

public String reverseNum(Integer i)
{
return new StringBuilder(i.toString()).reverse();
}

标签:java,number-formatting
来源: https://codeday.me/bug/20191003/1850368.html