Answer to Question #257523 in Java | JSP | JSF for Nikhil Sahoo

Question #257523

In Java, Write a program to store 20 numbers in an array then display those numbers in one column and the digits in another column with comma within the digits as follows:

2345 2,3,4,5

260 2,6,0


1
Expert's answer
2021-11-01T08:28:19-0400
import java.util.Scanner;  
public class Main 
{  
public static void main(String[] args)  
{  
Scanner sc = new Scanner(System.in);  
int[] arr={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
for(int i=0;i<20;i++){
System.out.print(arr[i]);




}
for(int j=0;j<20;j++){
System.out.print(" "+arr[j]+",");


}
}  
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS