myrdok123

First Steps In Coding - Lab Demo

Sep 7th, 2024
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.13 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Demo {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.  
  10.         //1. Задължително използваме EN
  11.         //2. camelCase -> започваме с малка буква и всяка следваща дума е с главна буква studentName, currentAge
  12.         //3. Максимално описателна -> currentAge, studentName
  13.  
  14. /*
  15.         int currentAge = Integer.parseInt(scanner.nextLine());
  16.  
  17.         double salary = Double.parseDouble(scanner.nextLine());*/
  18.  
  19.         char symbol = 'c';
  20.  
  21.  
  22.         int number1 = 5;
  23.         int number2 = 2;
  24.  
  25.         //1. Събиране ->
  26.         int sum = number1 + number2;
  27.  
  28.         //2. Изваждане
  29.         int result = number1 - number2;
  30.  
  31.         //3. Умножение
  32.         int multiply = number1 * number2;
  33.  
  34.         //4. Деление
  35.         int division = number1 / number2;
  36.  
  37.         //5. Деление с остатък
  38.         int substitution = number1 % number2;
  39.  
  40.  
  41.         System.out.println(substitution);
  42.  
  43.  
  44.  
  45.  
  46.  
  47.     }
  48. }
  49.  
Advertisement
Add Comment
Please, Sign In to add comment