数根 数也有根吗?有!数根就是把一个数的各个数位上的值相加,直到得到一个一位数为止。请你编写一个程序来计算任意数N(0≤N≤1000000000000)的...
代码说明:
数根 数也有根吗?有!数根就是把一个数的各个数位上的值相加,直到得到一个一位数为止。请你编写一个程序来计算任意数N(0≤N≤1000000000000)的根。 输入: 输入有多个案例。每一个案例为一行,每行只有一个整数N。当输入的N是-1时,输入结束。 输出: 每一个案例输出一行。每行只有一个数字,就是N对应的数根。 Sample input 39 -1 Sample output 3-Number of root number also has roots do? There is! The number of roots is to a number of different values on the digital sum until they have been a number of up to one. Please write a program to calculate an arbitrary number N (0 ≤ N ≤ 1000000000000) roots. Input: Enter a number of cases. Each case for the line, each line is only an integer N. When the input of N is-1, the input end. Output: the output line of each case. There is only one number per line, that is, N corresponds to the number of roots. Sample input 39-1 Sample output 3
下载说明:请别用迅雷下载,失败请重下,重下不扣分!