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
Explain simple telephone communication system with circuit and equation of current flow in microphone? Simple Telephone Communication: In the simplest type of a telephone cir

What is the need of interrupt controller?  The interrupt controller is employed to expand the interrupt inputs. It can handle the interrupt requests from several devices and pe

Explain the characteristics and utilities available into java that makes it appropriate for developing e-commerce applications. Following are the characteristics and utilities

Static or Dynamic - artificial intelligence An environment is static if it doesn't change while an agent's program is making the decision about how to act. When programming ag

State about the Object models Object models are used for explaining the objects in the system and their connection with each other in the system. The dynamic model explains in

Explain Recursive Descent Parsing It is a top down parsing with no backtracking. This parsing method uses a set of recursive processes to perform parsing. Most important advant

Prove the following Boolean identities using the laws of Boolean algebra (A + B)(A  + C) = A + BC Ans. (A+B)(A+C)=A+BC LHS AA+AC+AB+BC=A+AC+AB+BC OR  A((C+1)+A(B+1))+BC

What is the need of a hybrid in telephone networks? Digital exchanges need receive and transmit signals upon separate two-wire circuits. It calls for two-wire to four-wire con

DVD-ROM employs same principle as a CD-ROM for reading and writing. However a smaller wavelength laser beam is used. Total capacity of DVD-ROM is 8.5GB. In double-sided DVD-ROM two

Q. What is Serial Mouse? Mice that use standard serial port are known as 'serial'. Because Serial ports 1 and 4 (COM1, COM4 under DOS, /dev/ttyS0 and /dev/ttyS3 under Unix/GNU-