Facebook
From Karol, 2 Months ago, written in Java.
Embed
Download Paste or View Raw
Hits: 26
  1. import java.util.Scanner;
  2.  
  3. public class przesuniecie {
  4.  
  5.         public static void main(String args[]) {
  6.             Scanner przes = new Scanner(System.in);
  7.             int[] tablica = { 1, 2, 3, 4, 5, 6 };
  8.             System.out.print("Wprowad┼║ przesuni─Öcie k: ");
  9.             int k = przes.nextInt();
  10.  
  11.             for (int i = 0; i < tablica.length; i++){
  12.                 tablica[i] = tablica[i] + k;
  13.             }
  14.             System.out.print(tablica[0] + " ");
  15.             System.out.print(tablica[1] + " ");
  16.             System.out.print(tablica[2] + " ");
  17.             System.out.print(tablica[3] + " ");
  18.             System.out.print(tablica[4] + " ");
  19.             System.out.print(tablica[5] + " ");
  20.         }
  21.     }