Flag Discuss with Askiitians Tutors> java...
question mark

what is code for adding two integers in java

K Nirmala , 13 Years ago
Grade 12th Pass
anser 3 Answers
qwertykey key

hey its very simple

you need to use the + operator for adding nos in java

ex,

int a=9;

int b=1;

int s=a+b;

System.out.println(s);

the output will be 10

say thanks to qwertykey;for more help reply me on askiitians forum

Last Activity: 13 Years ago
bhaveen kumar

a = 5;

b = 10;

c = a + b;

System.out.println("The sum is " + c);

Last Activity: 13 Years ago
Aravind Bommera
import java.util.Scanner;
 
class AddNumbers
{
public static void main(String args[])
{
int x, y, z;
System.out.println("Enter two integers to calculate their sum ");
Scanner in = new Scanner(System.in);
x = in.nextInt();
y = in.nextInt();
z = x + y;
System.out.println("Sum of entered integers = "+z);
}
}
Last Activity: 13 Years ago
star
LIVE ONLINE CLASSES

Prepraring for the competition made easy just by live online class.

tv

Full Live Access

material

Study Material

removal

Live Doubts Solving

assignment

Daily Class Assignments