Skip to content
Advertisement

How to add two integers in one line

Hello im new to java and in my class my prof wants us to create a program that will compute the sum of two numbers. (Use methods) For example: Input an integer: 95 //Expected Output: The sum is 14 //(9+5=14)

im really lost on this one because i really don’t know how to do this please help

Advertisement

Answer

If you use Java you can use this code:

JavaScript

(The code in JavaScript is very similar)

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement