+ 1
How can I print the sum of two variable
Java
7 Antworten
+ 11
Yes, please go through java course and make sure to use the search bar before posting to avoid duplicates.
Cheers!
+ 4
Use "+". Just be sure that the variables are bkth same type
+ 4
And please go through tutorial, it is described there
+ 2
use this:
int var1= 10;
int var2= 14;
int sum= var1+var2;
System.out.print(sum);
👍
0
type this
#include <iostream>
int main() {
int a
int b
cin>>a>>b
cout<<a+b
0
Anju Sharma in Java please
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);
}}