+ 1

How can I print the sum of two variable

Java

2nd Feb 2019, 8:23 PM
Echobravo
7 Réponses
+ 11
Yes, please go through java course and make sure to use the search bar before posting to avoid duplicates. Cheers!
2nd Feb 2019, 9:10 PM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar
+ 4
Use "+". Just be sure that the variables are bkth same type
2nd Feb 2019, 8:45 PM
Maneren
Maneren - avatar
+ 4
And please go through tutorial, it is described there
2nd Feb 2019, 8:47 PM
Maneren
Maneren - avatar
+ 2
use this: int var1= 10; int var2= 14; int sum= var1+var2; System.out.print(sum); 👍
4th Feb 2019, 10:24 PM
Tomasz Lis
Tomasz Lis - avatar
0
type this #include <iostream> int main() { int a int b cin>>a>>b cout<<a+b
5th Feb 2019, 11:19 AM
Anju Sharma
Anju Sharma - avatar
0
Anju Sharma in Java please
5th Feb 2019, 11:30 AM
Maneren
Maneren - avatar
0
import java.util.scanner class add{ public static void main(string args[]) {int a,b,c; scanner sc= new scanner(system.in) system.out.println("enter a:"); a=sc.nextInt(); system.out.println("enter b:"); b=sc.nextInt(); c=a+b; system.out.println(c); }}
9th Feb 2019, 6:37 AM
Mohammed Sadaqhath
Mohammed Sadaqhath - avatar