forked from WebAce-Group/java101-edycja1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZadanie1.java
More file actions
42 lines (34 loc) · 1.35 KB
/
Zadanie1.java
File metadata and controls
42 lines (34 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
public class Zadanie1 {
public static void main(String[] args) {
//deklaracja i przypisanie wartosci zmiennym
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int ab = a + b;
int cd = d - c;
double e = 1.1;
double f = 2.2;
double g = 3.3;
double h = 4.4;
double ef = e*f;
double gh = g/h;
//Sprawdzanie reszty z dzielenia liczby ab przez b
System.out.println("Reszta z dzielenia liczby ab prze liczbe b to: " + (ab%b));
char i,j;
i= 'A';
j= 'a';
System.out.println("Wartość liczby i+j = " + (i+j));
//Zmienne typu char mozna do siebie dodawac, a wynikiemm bedzie suma wartosci z tablicy kodow ASCII
String k,l;
k = "Ala";
l = "ma";
System.out.println("Wynik dodawania k + l = " + (k+l));
//Stringi mozna do siebie dodawac, a wynikiem jest zlepek slow przypisanych do zmiennych
boolean m,n;
m = true;
n = false;
//Wyswietlenie wszystkich zmiennych
System.out.println("Wartość m && n = " + (m&&n));
System.out.println("a= "+ (a) + ", b= "+(b) + ", c= "+(c)+ ", d= "+(d) + ", e= "+(e)+", f= "+(f)+", g= "+(g)+", h= "+(h)+", ab= "+(ab)+", cd="+(cd)+", ef= "+(ef)+", gh="+(gh)+", i= "+(i)+", j="+(j)+", k= "+(k)+", l= "+(l));
}