Question: unsure of why my java code is not working. I have written the code down below as well. The goal of this code is to

unsure of why my java code is not working. I have written the code down below as well. The goal of this code is to write a program that gets a three-digit integer (99

import java.io.*; import java.lang.*; import java.util.*;

public class problemSolution{ public int sum(int i){ int num = 0; System.out.println("Please input a 3 digit number to add each digit together"); num = in.nextInt(); if (99 < num < 1000) { num = num + i % 10; i = i / 10; System.out.println(sum(i)); } else { System.out.println("-1"); } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!