Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. public class massiv{
  2.  
  3. public static void main(String[] args) {
  4.  
  5. int[] array = new int[10];
  6. array[0] = 1;
  7. for (int i = 0; i < array.length; i++){
  8. array[i] = array[i]+3;//вот тут туплю - не пойму как решить
  9. System.out.println(array[i]);
  10. }
  11. }
  12. }
  13.  
  14. public static void main(String[] args) {
  15.  
  16. int[] array = new int[10];
  17. array[0] = 1;
  18. for (int i = 1; i < array.length; i++){
  19. array[i] = array[i-1] + 3;//вот тут туплю - не пойму как решить
  20. System.out.println(array[i]);
  21. }
  22.  
  23. array[i] = array[i-1]+3;
  24.  
  25. public static void main(String[] args) {
  26. int[] array = new int[10];
  27. int value = 1;
  28. for (int i = 0; i < array.length; i++) {
  29. array[i] = value;
  30. value += 3;
  31. System.out.println(array[i]);
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement