-3

I am not asking for the whole answer. I am just confused on how to start and which kind of loop I should use for the index.

Define a list of 10 int values and use a loop to print all the values based on their index. Program code defined an array with these ten integer values: 91, 94, 88, 85, 96, 100, 78, 91, 100, 98

Example Ouput:

The numbers in my array:

Index 0: 91 Index 1: 94 Index 2: 88 Index 3: 85 Index 4: 96 Index 5: 100 Index 6: 78 Index 7: 91 Index 8: 100 Index 9: 98

JaneDoe1000
  • 1
  • 1
  • 3

1 Answers1

0

try the below code:

public class Main {
    public static void main(String args[]) {
        int arraySample[] = { 91, 94, 88, 85, 96, 100, 78, 91, 100, 98 };
        for (int i = 0; i < arraySample.length; i++) {
            System.out.println("Index " + i + " : " + arraySample[i]);
        }
    }
}
Vivek Singh
  • 2,047
  • 11
  • 24