---
# System prepended metadata

title: Java_Cmoney_ft9102_填空練習
tags: [Cmoney_Java題目]

---

---
tags: Cmoney_Java題目
---
Java_Cmoney_ft9102_填空練習
===

![](https://i.imgur.com/pHFqDkZ.png)


1.主程式
---


```java=
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] numbers = new int[4];
        for (int i = 0; i < 4; i++) {
            numbers[i] = sc.nextInt();
        }
        if (numbers[1] - numbers[0] == numbers[2] - numbers[1])
            System.out.println(numbers[1] - numbers[0] + numbers[3]);
        else if (numbers[1] / numbers[0] == numbers[2] / numbers[1])
            System.out.println(numbers[1] / numbers[0] * numbers[3]);
    }
}
```
