what is code for adding two integers in java?, Computer Engineering

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);
   }
}

Posted Date: 3/11/2013 2:07:42 AM | Location : United States





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

Posted by | Posted Date: 3/11/2013 2:08:04 AM


Related Discussions:- what is code for adding two integers in java?, Assignment Help, Ask Question on what is code for adding two integers in java?, Get Answer, Expert's Help, what is code for adding two integers in java? Discussions

Write discussion on what is code for adding two integers in java?
Your posts are moderated
Related Questions
What is the Vertical Organizational Structure? This is a traditional approach that is typified by a functional approach to work in that departments work onto tasks relevant to

Question: a) Describe what is meant by a "bus". There are two types of bus, dedicated and multiplexed. Give a brief description of both types of buses. b) Briefly explain f

why impotant keys

Device Drivers in UNIX, MS-DOS and Windows System Though device drivers are in effect add-on modules they are however considered to be part of system because they are closely i

Q. Explain about integrated circuit? An integrated circuit is created on a thin wafer of silicon that is splitted into a matrix of small areas (size of the order of a few m.m.

ADDING LAYERS TO THE TIMELINE AND GIVING MOTION TO THE LAYER Step 1:  Choose Layer from Common toolbar after that draw a layer. Step 2:  Write the text inside Layer. Step

Suppressing the number signs (+/-) is carried out using the addition NO-SIGNS to the Write statement. Statement is false.

Legacy systems and current infrastructure - Information System This problem is most easily understood using the everyday example of the rail ways where the rail network infras

Reading Decision Trees: However we can justified by see that a link between decision tree representations and logical representations that can be exploited to make it easier t

Develop and submit an original implementation of a data entry application. Identify and declare variables which will hold all data that needs to be entered to fill in the attached