AmidamaruZXC

Untitled

Dec 1st, 2020
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner in = new Scanner(System.in);
  7.         System.out.print("Введите n: ");
  8.         int n = in.nextInt();
  9.         System.out.print("Введите m: ");
  10.         int m = in.nextInt();
  11.         int x = 0, temp = 1;
  12.         for (int i = 1; i <= n; i++) {
  13.             x += i - 5;
  14.             temp *= i;
  15.         }
  16.         x += temp;
  17.         temp = 1;
  18.         for (int j = 1; j <= m; j++)
  19.             temp *= (j * j + 1);
  20.         x += temp;
  21.         System.out.println("X = " + x);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment