'Algorithm&DataStructures/StepByStep'에 해당되는 글 17건

donaricano-btn

MakingStar(1)


1.Question

1) Enter a Number N

2) You should make a tier star top

3) First layer line has a star, Second has two.....and Last layer has N star 

4) Layer size must be N


2. Solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.util.Scanner;
 
public class MakingStar_1 {
     
    public static void main(String[]args){
         
        Scanner n = new Scanner(System.in);
         
        int a = n.nextInt();
         
        for(int i = 0; i<a; i++){
            for(int k = 0; k<i+1; k++){
                System.out.print("*");
            }
            System.out.println();
        }
         
    }
}

https://github.com/KyleJeong/Algorithm
블로그 이미지

리딩리드

,
donaricano-btn

Multiplication table


1. Question

1) Enter a number N

2) To print out from N*1 to N*9


2. Solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import java.util.Scanner;
 
public class MultiplicationTable {
     
    public static void main(String[]args){
         
        Scanner a = new Scanner(System.in);
        int b = a.nextInt();
        int c;
         
        for(int i = 1; i<10; i++){
            c = b * i;
            System.out.println(b+" * "+i+" = "+ c);
        }
    }
}

https://github.com/KyleJeong/Algorithm
블로그 이미지

리딩리드

,
donaricano-btn

CountBackwardsN


1. Question

1) You have a number N

2) Print out numbers backwards from N to 1


2. Solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import java.util.Scanner;
 
public class CountBackward {
     
    public static void main(String[]args){
         
        Scanner c = new Scanner(System.in);
         
        int a = c.nextInt();
         
        for(int i = a; i>0; i-- ){
            System.out.println(i);
        }
         
    }
 
}

https://github.com/KyleJeong/Algorithm
블로그 이미지

리딩리드

,
donaricano-btn

N

1. Qustion

1) If you have a number N, you will display number from 1 to N


2. Solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package forLogic;
 
import java.util.Scanner;
 
 
public class N {
     
    public static void main(String[]args){
         
        Scanner c = new Scanner(System.in);
         
        int a = c.nextInt();
         
        for(int i = 1; i<a+1; i++){
            System.out.println(i);
        }
         
    }
 
}

https://github.com/KyleJeong/Algorithm
블로그 이미지

리딩리드

,