tel-ran-de / 24-evening-basic

1 stars 2 forks source link

JavaWeb 2021-12-01 #1

Open Andy179176 opened 2 years ago

Andy179176 commented 2 years ago
  1. Try to find on your keyboard the specials symbols: “ [ ] { } ( ) & * ^ ~ - + _ : ; “” \ / | ”. You should be able to find these symbols quite quickly.
  2. Implement the program that prints to screen “I think: “Java is easy.” ”
  3. Implement the program that prints to screen the result 11+21+31
  4. Read about variables
  5. Implement the program that prints to screen “area of a square with a side (side) is (area)”. The side and the area should be integer variables.
  6. Implement the program that prints to screen the result of addition, subtraction, multiplication and division of two numbers. The numbers and the result should be variables.

.

LevKhaliapin commented 2 years ago

Задание выполнил.

package com.company;

import java.sql.SQLOutput;

public class Main {

public static void main(String[] args) {

    //задание №1: [] {} () & * ^ ~ - + _ :; "" \/|

    System.out.println("I think: " + "\"Java is easy.\"");  //задание №2

    System.out.println(11+21+31); //задание №3

    //задание №4: I read about variables

    int side = 3;
    System.out.println("area of a square with a side " + side + " is " + (side*side)); //задание №5

    int a = 9;   //задание №6
    int b = 3;
    int addition = a + b;
    int subtraction = a - b;
    int multiplication  = a * b;
    int division = a / b;
    System.out.println(addition);
    System.out.println(subtraction);
    System.out.println(multiplication);
    System.out.println(division);

}

}