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
For this assignment, you will need to create an ARM assembly language code routine that implements an algorithm to search through an array and find BOTH the minimum and maximum val

This document is intended to help students get started with the real-time systems (RTS) assignment. We will start on the assignment together in the laboratory. Students will then c

A macro definition consists of ? Ans. A macro Definition have: A macro prototype statement, one or various model statements and also Macro pre-processor statements

Q. Illustrate Shift Micro-operations? Shift is a valuable operation that can be used for serial transfer of data. These operations can also be used along with other (arithmetic

The result of adding hexadecimal number A6 to 3A is ? Ans. The result will be E0.

Virtual Memory is a way of extending a computer's memory by using a disk file to replicate add'l memory space. The OS remain track of these add'l memory addresses on the hard disk

explain classification of computers in detail.also explain various application areas of computers

Storage Technology: In the previous section, the, recent innovations relating to the processing aspects of computer technology were discussed briefly. In considering some of t

Illustrate the Logical view of a system The Logical view of a system serves to describe existence and meaning of key abstractions and mechanism which form problem space, or wh

a) What do you meant by digital forensics? b) What is the job of Computer Forensic Analyst c) From the point of view of : i. An employer ii. An employee Give thre