Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
134
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. public class trzydziescipiec {
  3.        
  4.  
  5.     public static void main(String[] args) {
  6.         int liczbnaNaturalna;
  7.         Scanner sc = new Scanner(System.in);
  8.         System.out.println("Wprowadź liczbę naturalna: ");
  9.         liczbaNaturalna= sc.nextInt();
  10.        
  11.         boolean liczbaParzysta = liczbaNaturalna % 2 ==0 ? true : false;
  12.         if(liczbaParzysta){
  13.             System.out.printf("Liczba %d jest parzysta", liczbaNaturalna);
  14.         }else{
  15.             System.out.printf("Liczba %d jest nieparzysta", liczbaNaturalna);
  16.                
  17.             }
  18.         }
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement