-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathL4L1.java
More file actions
33 lines (26 loc) · 848 Bytes
/
L4L1.java
File metadata and controls
33 lines (26 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//Ranye Mclendon
//EEGR 409
//Lecture 4 Lab 1
//02/24/2022
//This is a program reads 10 numbers,stores them in an array, and prints the reverse
import java.io.*;
import java.util.Scanner;
public class L4Ll {
public static void main (String[] args) throws IOException{
//declare variables
int[] a = new int[10];
int i;
//ask user for numbers
Scanner in = new Scanner(System.in);
System.out.println("Enter 10 numbers: ");
//store numbers in an array
for(i=0; i < 10; i++){
a[i] = in.nextInt();
}
System.out.print("The reverse of the number you printed are: ");
for(i = 9; i >= 0; i--){
//print the array in reverse
System.out.print( a[i] + "");
}
}
}