Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.81 KB | None | 0 0
  1. 07.
  2.  
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class demo {
  7.     public static void main(String[] args) {
  8.  
  9.         Scanner scanner = new Scanner(System.in);
  10.  
  11.         String input = scanner.nextLine();
  12.  
  13.         int max = Integer.parseInt(input);
  14.  
  15.         for (int i = 0; i < max; i++) {
  16.  
  17.             for (int j = 0; j < max; j++) {
  18.                 if (j+1 == max){
  19.                     System.out.print(input);
  20.                     break;
  21.                 }
  22.                 System.out.print(input + " ");
  23.             }
  24.             System.out.println();
  25.         }
  26.  
  27.     }
  28. }
  29.  
  30.  
  31.  
  32. 08.
  33.  
  34. import java.awt.geom.Path2D;
  35. import java.util.Scanner;
  36.  
  37. public class demo {
  38.     public static void main(String[] args) {
  39.  
  40.         Scanner scanner = new Scanner(System.in);
  41.  
  42.         int num = Integer.parseInt(scanner.nextLine());
  43.         double n = Double.parseDouble(scanner.nextLine());
  44.  
  45.         long factoriel = factorialUsingForLoop(num);
  46.  
  47.         double number = factoriel/n;
  48.  
  49.         System.out.printf("%.2f",number);
  50.  
  51.  
  52.     }
  53.     public static long factorialUsingForLoop(int n) {
  54.         long fact = 1;
  55.         for (int i = 2; i <= n; i++) {
  56.             fact = fact * i;
  57.         }
  58.         return fact;
  59.     }
  60. }
  61.  
  62.  
  63.  
  64.  
  65. 09.
  66.  
  67.  
  68. import java.awt.geom.Path2D;
  69. import java.util.Arrays;
  70. import java.util.Collections;
  71. import java.util.List;
  72. import java.util.Scanner;
  73. import java.util.stream.Collectors;
  74.  
  75. public class demo {
  76.     public static void main(String[] args) {
  77.  
  78.         Scanner scanner = new Scanner(System.in);
  79.  
  80.         while (true){
  81.  
  82.             String cmd = scanner.nextLine();
  83.  
  84.             if (cmd.equalsIgnoreCase("END")){
  85.                 break;
  86.             }
  87.            
  88.             System.out.println(cmd.equalsIgnoreCase(new StringBuilder(cmd).reverse().toString()));
  89.         }
  90.  
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement