HW4.2】的更多相关文章

import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter an integer: "); int number = input.nextInt(); int mask = 1; for(int i = 15; i > 0; i--)…
public class Solution { public static void main(String[] args) { int count = 0; for(int i = 1; i <= 7; i++) { for(int j = i + 1; j <= 7; j++) { System.out.println(i + "\t" + j); count++; } } System.out.println("Total groups number is…
public class Solution { public static void main(String[] args) { double randX; double randY; int hitCount = 0; for(int i = 0; i <= 1000000; i++) { randX = Math.random() * 200 - 100; randY = Math.random() * 200 - 100; if(randX < 0) hitCount++; if(ran…
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the number of second: "); int countDown = input.nextInt(); input.close(); long startTime =…
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a commission sought: "); int commissionSought = input.nextInt(); input.close(); double sum…
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter numbers: "); int max = 0; int count = 0; int number; while(true) { number = input.nextInt(…
public class Solution { public static void main(String[] args) { long positiveSide = 0; long negativeSide = 0; int side; for(long i = 0; i < 1000000; i++) { side = (int)(Math.random() * 2); if(side == 1) positiveSide++; else negativeSide++; } System.…
public class Solution { public static void main(String[] args) { double sum; double baseSalary = 5000; int i = 0; double prize = 0; while(true) { if(i <= 5000) prize = i * 0.08; else if(i <= 10000) prize = i * 0.1; else prize = i * 0.12; i++; sum =…
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter an integer: "); int number = input.nextInt(); input.close(); String[] charOfNumber = {&quo…
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the integer: "); int number = input.nextInt(); input.close(); String binaryString = "…