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


int a=9;

int b=1;

int s=a+b;


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
Security Analysis: Suppose you are a young securities analyst, working in a small brokerage firm. You have access to publicly available information relevant to valuation of th

The number 140 in octal is equivalent to decimal number ? Ans. (140) 8 = (96) 10 As 1 x 8 2 + 4 x 8 + 0x 1 = 64 + 32 = 96

Search mechanisms in Prolog: Here we can needs this simple Prolog program to describe how Prolog searches as:president(X) :- first_name(X, georgedubya), second_name(X, bush).

Q. Displaying the List of Files with DIR? You can display the list of files kept in a diskette or hard disk with the DIR commend. This Commends list files and sub directories i

What are the advantages and disadvantages of macro pre-processor? Advantages Any of existing conventional assembler can be improved in this way to incorporate macro proces

what is Asynchronous Finite State Machines?

Q. High Level Language Program Characteristics? So it is clear that new architectures must support high-level language programming. A high-level language system can be implemen

Divide (101110) 2   by (101) 2 Ans. Quotient is = -1001 Remainder is = -001

Define Linear Probing Linear Probing:  The easiest way to resolve a collision is to begin with the hash address and do a sequential search by the table for an empty location.