🔒 Closed tulong po sa java. Multi Array

Status
Not open for further replies.

PHC-Slick

Fanatic
May code na po ako pero kulang tlga. d kasi nag rerepeat yung "Enter Number" pra mag accept ng INT.

ito po code ko

Java:
import java.util.Scanner;
class Main{
    public static void main(String[] args)
    {
        Scanner sc= new Scanner(System.in);
        int[][] array = new int[10][2];
      
      
        for (int i=0; i<10; i++)
        {
            for (int j=0; j<2; j++)
            {
  
                int num = sc.nextInt();
                array[I][j] = num;
                }
               
            }  
           
       
        for (int i=0; i<10; i++)
        {
            if(i == 5)
            {
                System.out.println();
            }
           
            for (int j=0; j<2; j++)
            {
                System.out.print(array[I][j] + "\t");
            }
           
                System.out.println();
            }
       
    }
}
 

Attachments

  • input.webp
    input.webp
    18.7 KB · Views: 30
Bakit wala ako makitang "Enter a number" sa code mo?
Ilagay mo yun above sa bago ka kumuha ng value from the user syempre.
 
Status
Not open for further replies.

About this Thread

  • 4
    Replies
  • 412
    Views
  • 3
    Participants
Last reply from:
--AnonMask--

Trending Topics

Online now

Members online
1,273
Guests online
1,779
Total visitors
3,052

Forum statistics

Threads
2,294,007
Posts
29,087,997
Members
1,208,032
Latest member
wonderboi
Back
Top