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
Q. Binary floating-point number range? Smallest Negative number   Maximum mantissa and maximum exponent     =    - (1 -2 -24 ) × 2 127   Largest negative number

Q. Describe types of complements? There are two kinds of complements for a number of base (also known as radix) r. These are known as r's complement and (r- 1)'s complement. Fo

Explain the term - Computer Aided Software Engineering Production of software became much commercial. Software development tools were devised. Concept of Computer Aided Softwar

Q. Use of Overlapped Register Windows? Register file comprises 138 registers. Let them be called by register number 0 - 137.  Diagram demonstrates the use of registers: when

Case Study - A taxi company has 200 taxies. The company provides its services to all the nine districts in Mauritius, about 20 taxies per district. A taxi is normally attached to

Program to calculate the value of the series 1+x+x2+x3+.... +xn. Read the values of ''x'' and ''n'' from the keyboard.

What is "Common Type System" (CTS)?  CTS explain all of the basic types that can be used in the .NET Framework and the operations performed on those type. All this time we hav

Question: (a) There are several camera angles that can be used to make a sequence more interesting for a video production project. Explain clearly, using diagrams where appro

What are the different database integrities? Semantic Integrity. Relational Integrity. Primary Key Integrity. Value Set Integrity. Foreign Key integrity and

What are the steps involved in authentication? Steps in Authentication The control over the access of the resources in the repository is exercised in two steps namely Auth