hpilo

Chapter2_SyntaxC_Ex3

Dec 15th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. /*  ==================================================
  2.           Chapter 2: Syntax section C- Arrays
  3.  
  4.                 Ex3: Array values X3
  5.     ===================================================
  6. */
  7.  
  8. public class MyProgram {
  9.     public static void main(String[] args) {
  10.  
  11.         //variables
  12.         final int SIZE=10;
  13.         int arr[]=new int[SIZE];
  14.  
  15.         System.out.println("Array values X3: ");
  16.  
  17.         //init array values X3
  18.         for(int i=0,value=0;i<SIZE;i++,value+=3){
  19.             arr[i]=value;
  20.             System.out.print(arr[i]+" ");
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment