Advertisement
sneyzi

Laba 11, 3

Jun 10th, 2021
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Task3 {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.         System.out.print("x: ");
  8.         int x = scanner.nextInt();
  9.  
  10.         int f = 0;
  11.         if (x < 0) {
  12.             f = 4 * x - 1;
  13.         } else if (x > 0) {
  14.             f = 25 * x + 10;
  15.         } else if (x == 0) {
  16.             f = 0;
  17.         }
  18.  
  19.         System.out.println("F " + f);
  20.         scanner.close();
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement