Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) throws Exception {
- Scanner wczytanie2 = new Scanner(System.in);
- //wczytujemy 3 inty i przypisujemy ich wartosci do zmiennych a,b, c
- int a = wczytanie2.nextInt();
- int b = wczytanie2.nextInt();
- int c = wczytanie2.nextInt();
- //wyspiujesz zmienne a b c
- System.out.println(a + " " + b + " " + c);
- //tworzysz tablice dlugosci 3 i wrzucasz do niej zmienne a,b,c
- int[] tab1 = new int[3];
- tab1[0] = a;
- tab1[1] = b;
- tab1[2] = c;
- //tworzysz petle w ktorej
- for (int e = 0; e < tab1.length; e++) {
- //wrzucasz do tablicy nowe elementy, ktore wczytujesz z konsoli
- tab1[e] = wczytanie2.nextInt();
- //wypisujesz te elementy
- System.out.println(tab1[e] + " ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement