import
1 2 3public class Main { 4 public static void main(String[] args) { 5 6 Scanner sc = new Scanner(System.in); 7 int n = sc.nextInt(); 8 9 System.out.println(cul(n)); 10 } 11 public static int cul (int n){ 12 if (n <= 24) { 13 int x = n - 24; 14 return x; 15 } 16 else if (n > 24){ 17 return n; 18 } 19 } ← 20} 21コード
上記のコードで矢印の部分に
Main.java:20: error: missing return statement
というエラーが出てしまいますどなたか解決方法を教えていただけませんでしょうか

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/09/23 03:38