Can you recommend some code/codes for this question? Thanks a lot 🙏🏻 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you recommend some code/codes for this question? Thanks a lot 🙏🏻

Write a Java program to print the sum (addition), multiply, subtract, divide and remainder of two numbers.

9th Apr 2021, 10:55 AM
bon
bon - avatar
6 Answers
+ 1
It's too simple. Show us your code.
9th Apr 2021, 11:04 AM
Soumik
Soumik - avatar
+ 1
bon Your code's working fine. So what help do you want?
9th Apr 2021, 11:27 AM
Soumik
Soumik - avatar
0
import java.util.Scanner; public class Javaexcercise { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Input 1st number: "); int num1 = in.nextInt(); System.out.print("Input 2nd number: "); int num2 = in.nextInt(); System.out.println("Addition of two numbers: " + num1 + " + " + num2 + " = " + (num1 + num2)); System.out.println("subtraction of two numbers: " +num1 + " - " + num2 + " = " + (num1 - num2)); System.out.println("Multiplication of two numbers: "+ num1 + " x " + num2 + " = " + (num1 * num2)); System.out.println("Division of two numbers: " + num1 + " / " + num2 + " = " + (num1 / num2)); System.out.println("Remainder of two numbers: "+ num1 + " mod " + num2 + " = " + (num1 % num2)); } }
9th Apr 2021, 11:18 AM
bon
bon - avatar
0
Sorry, I know it’s very simple to others but I’m just a first year student
9th Apr 2021, 11:20 AM
bon
bon - avatar
0
Do you prefer something likes this? 😉 https://code.sololearn.com/c8a18A8A223A/?ref=app
9th Apr 2021, 12:07 PM
Ciro Pellegrino
Ciro Pellegrino - avatar
0
thanks a lot for helping me po🙏🏻🥺
9th Apr 2021, 12:35 PM
bon
bon - avatar