Question: Write a program that prompts the user to enter an integer (n) and a sum value (s). The program checks the value of (n
Write a program that prompts the user to enter an integer (n) and a sum value (s). The program checks the value of (n + n), if it is less than or greater than the entered sum (s), the program finds the needed value to be added to or subtracted from (n + n) in order to reach the given sum (s) and displays it, otherwise it displays that n +n = sum. Sample Run1: Enter an integer: 5 Enter a sum: 25 You need to add 15 to reach the sum. Sample Run2: Enter an integer: 8 Enter a sum: 6 You need to subtract 10 to reach the sum. Sample Run3: Enter an integer: 7 Enter a sum: 14 7 + 7 = 14. Java langauge using looop
Step by Step Solution
There are 3 Steps involved in it
import javautilScanner importing Scanner class public class Main public static v... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
636147048716a_235538.pdf
180 KBs PDF File
636147048716a_235538.docx
120 KBs Word File
