📜  将 java 转换为 python - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:29.894000             🧑  作者: Mango

代码示例6
import java.util.*;
public class fungsiA {

    public static void main(String args []) throws InterruptedException {
        Scanner sc = new Scanner(System.in);
        int n;
        System.out.print("Masukkan N :");
        n = sc.nextInt();
        long starTime = System.nanoTime();
        for (int i = 1; i <= n; i = i + 2) {
            for (int j = 1; j <= n/2; j++) {
                System.out.println(2);
            }
        }
        long endTime = System.nanoTime();
        long totalTime = (endTime - starTime) / 1000000;
        System.out.println("Total Time : " + totalTime + " milliseconds or " + (totalTime / 1000) + " seconds");
    }
}