Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company.damian;
- import java.util.Scanner;
- class Calculator {
- public static void main(String[] args) {
- /**
- * Zmienne najlepiej definiowac na samym poczatku.
- * Dzieki temu zawsze bedziesz wiedziec z gdzie ich szukac aby cos w nich zmienic.
- */
- Scanner input = new Scanner(System.in);
- int firstNumber = 0; // kazdy int jest zainicjalizowany zerem aby uniknac ewentualnych bledow braku inicjalizacji
- int secondNumber = 0;
- int result = 0;
- System.out.println("Podaj pierwsza liczbe:");
- firstNumber = input.nextInt();
- System.out.println("Podaj druga liczbe:");
- secondNumber = input.nextInt();
- result = firstNumber * secondNumber;
- System.out.println("Wynik to: " + result);
- if(result < 50) {
- if(result % 2 == 0 ) {
- System.out.println("Wynik parzysty i mniejszy od 50");
- } else {
- System.out.println("WYnik nieparzysty i mniejszy od 50");
- }
- } else {
- if(result % 2 == 0 && result != 50 ) {
- System.out.println("Wynik parzysty i wiekszy od 50");
- } else if(result == 50 ){
- System.out.println("Wynik rowny 50");
- } else {
- System.out.println("Wynik nieparzysty i wieszky od 50");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement