assignment operator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

assignment operator

can you give me a code that I will input 2 numbers and display a result in all assignment operator symbol.. example: I input 30 and 40 int a is 30 , int b is 40 and c = 0 output is c = a + b = "the result<--" c += a = c -= a = c *= a = c /= a = c %= a = etc...

25th Apr 2017, 10:38 AM
Dexter Torres Gregorio
Dexter Torres Gregorio - avatar
2 Answers
+ 2
This takes 2 inputs for the numbers and outputs the result. tweak it to your needs import java.util.*; import java.util.Scanner; class Dcoder { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int a=scan.nextInt(); int b=scan.nextInt(); System.out.println(one+two); System.out.println(one-two); } }
25th Apr 2017, 10:54 AM
LordHill
LordHill - avatar
+ 2
cout << c + a << ',' << ... << c % a;
25th Apr 2017, 10:55 AM
Bebida Roja
Bebida Roja - avatar