Answer:
see explaination
Step-by-step explanation:
import java.util.Scanner;
class Main
{
public static void main (String[] args)
{
int []A = new int[1000]; // Declaration of array which will store 1000 integers
for( int i = 0; i<1000; i++ )
A[i] = i; // will initialise elements of array equal to their index
System.out.print("Enter a value: ");
Scanner sc = new Scanner(System.in);
int num = sc.nextInt(); // Prompts the user to enter value
for( int i = 0; i<1000; i++ )
{
if( A[i]%num==0 ) //checks if the element is divisible by the entered value
A[i] = 3*A[i]; // Triples the value and reassigns to the same element
}
}
}