Advertisement
Guest User

Llama

a guest
Feb 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Lab11
  3. {
  4.     public static void main(String[] args)
  5.     {
  6.         Scanner keyboard = new Scanner(System.in);
  7.        
  8.         double[] y = new double[1000];
  9.        
  10.         for(int i = 0; i < y.length; i++)
  11.         {
  12.             y[i] = i * 7.5;
  13.            
  14.         }      
  15.        
  16.         for(int i = 0; i < y.length; i++)
  17.         {
  18.             System.out.println("Enter an array slot number:");
  19.             i = keyboard.nextInt();
  20.            
  21.             dif(i < y.length)
  22.                 {
  23.                     System.out.println("The value in array slot " + i + " is " + y[i]);
  24.                 }
  25.            
  26.             else
  27.                 {
  28.                     System.out.println("Value out of range.");
  29.                 }
  30.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement