Please teach me how to insert the result values into the array

Asked 2 years ago, Updated 2 years ago, 42 views

If you get a number, you get the answer of multiplication tables I want to put one of those printed values in the array, but it's stuck here crying Please teach me how to put it in an array <

import java.util.Scanner;

public class test1 {



    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);        
        System.out.println ("Enter Numbers");


        int num = sc.nextInt();
        int cnt = 0;
        String[] gugu = new String[cnt];

        if(num > 1){
            for(int i=2 ; i<10 ; i++){
                for(int j=1 ; j<10 ; j++){
                    if(num == i*j){

                        cnt++;
                        System.out.println(i + "x" + j + "=" + i*j);

                    }                   
                }
            }
        }   
    }
}

java array

2022-09-21 21:51

1 Answers

array during initialization of the array the size of the set, I can't change the size of the array .. So the intial value for good measure should be specified. In this framework there is a collection of because of disadvantage. of the list, you can easily add or remove data, the . You can implement sufficiently the desired function, if you look at the river below.

http://tryhelloworld.co.kr/courses/ Java-Intermediate/lessons/list


2022-09-21 21:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.