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

donaricano-btn

REST

1) Enter three values

2) Show me result of rest(%)

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

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

리딩리드

,
donaricano-btn

A/B

1) You enter two values 

2) Show me result of division

3) but You have to calculate down to nine places of decimal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.util.Scanner;
 
public class Division {
     
    public static void main(String[]args){
         
        Scanner sc = new Scanner(System.in);
         
        int a, b;
         
        a = sc.nextInt();
        b = sc.nextInt();
         
        System.out.println( (double)a/ (double)b);
         
         
    }
}

https://github.com/KyleJeong/Algorithm


블로그 이미지

리딩리드

,
donaricano-btn

A-B  

1) You enter two values 

2) Show me result of minus

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import java.util.Scanner;
 
public class Minus {
     
    public static void main(String[]args){
         
        Scanner sc = new Scanner(System.in);
        int a,b ;
        a = sc.nextInt();
        b = sc.nextInt();
         
        System.out.println(a-b);
         
    }
}

https://github.com/KyleJeong/Algorithm


블로그 이미지

리딩리드

,
donaricano-btn

A+B

1. Question

1) You enter two values 

2) Show me result of sum 


2. Solution

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

https://github.com/KyleJeong/Algorithm


블로그 이미지

리딩리드

,