软微java作业第二次-计蒜客进制转换

import java.util.Scanner; 
public class Main { 
public static void main(String[] args) { 
Scanner input = new Scanner(System.in); 
int m = input.nextInt(); 
int k = input.nextInt(); 
trans(m,k); 
} static void trans(int m, int k) 

int a[] = new int[1024]; 
int i; 
for(i = 0; m != 0; i++) 

a[i] = m % k; 
m /= k; 

for(i-=1; i >= 0; i--) 
System.out.print((a[i])); 

猜你喜欢

转载自blog.csdn.net/hua111hua/article/details/83150685