1.1
public class test { public static void main(String[] args) { System.out.println("Welcome to java"); System.out.println("Welcome to Computer Science"); System.out.println("Programming is fun"); } }
1.2
public class test { public static void main(String[] args) { for(int i = 0; i < 5; i++) { System.out.println("Welcome to Java"); } } }
1.3
public class test { public static void main(String[] args) { System.out.println(" J A V V A"); System.out.println(" J A A V V A A"); System.out.println("J J AAAAA V V AAAAA"); System.out.println(" JJ A A V A A"); } }
1.4
public class test { public static void main(String[] args) { System.out.println("a a^2 a^3"); System.out.println("1 1 1"); System.out.println("2 4 8"); System.out.println("3 9 27"); System.out.println("4 16 64"); } }
1.5
public class test { public static void main(String[] args) { double s = (9.5*4.5-2.5*3)/(45.5-3.5); System.out.println(s); //0.8392857142857143 } }
1.6
public class test { public static void main(String[] args) { int s=0; for(int i=0; i<10; ++i) { s+=i; } System.out.println(s); //45 } }
1.7
public class test { public static void main(String[] args) { double pi = 0; double t; int m=1; for(int i=1; i<12121358; i++) { t=1.0/(2*i-1); t*=m; pi+=t; m*=-1; } pi*=4; System.out.println(pi); //3.1415927360890374 } }
时间: 2024-10-10 17:15:19