Advertisement
winone1208

Java zad1

Mar 19th, 2021
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. package pl.patrykk;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.  
  9.         Scanner scanner = new Scanner(System.in);
  10.         System.out.println("Podaj liczbę:");
  11.         int rok = scanner.nextInt();
  12.  
  13.         if (rok%4 == 0 && (rok%100 != 0 || rok%400 == 0)){
  14.  
  15.             System.out.println("Rok " + rok + " jest przestępny");
  16.  
  17.         }else {
  18.  
  19.             System.out.println("Rok " + rok + " nie jest przestępny");
  20.  
  21.         }
  22.  
  23.  
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement