Q:

define array in java and give values using for loop then print the values again using for loop

0

define array in java and give values using for loop then print the values again using for loop

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
	 int myarary[]=new int[5];
	    Scanner input=new Scanner(System.in);
	    for(int i =0;i<5;i++)
	    {
	        System.out.print("enter number: ");
	        myarary[i]=input.nextInt();
	    }
	    
	    System.out.print("array values are: ")
	    for(int i=0;i<5;i++)
	    {
	        System.out.print(myarary[i]+" ");
	    }
	}
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now