Arrays

mail@pastecode.io avatar
unknown
java
2 years ago
602 B
5
Indexable
Never
package com.sai.datastructures;

// library import
import java.util.Scanner;

// Class declaration
public class Prakash {

    // main method or function, starting point of program execution
    public static void main(String[] args) {
        // arrays

        // 0 -> size - 1
        int[] a = new int[5];
        double[] d = new double[5];

        Scanner sc = new Scanner(System.in);

        for (int i = 0; i < 5; i++) {
            a[i]= sc.nextInt();
        }

        for (int i = 0; i < 5; i++) {
            System.out.println("Value at index " + i +  " - " + a[i]);
        }

    }
}