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) 

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

1 Expert Approved Answer
Step: 1 Unlock

import javautilScanner importing Scanner class public class Main public static v... View full answer

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

Document Format (2 attachments)

PDF file Icon

636147048716a_235538.pdf

180 KBs PDF File

Word file Icon

636147048716a_235538.docx

120 KBs Word File

Students Have Also Explored These Related Programming Questions!