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 about the e-commerce over extranets. Extranets are regarding “joining up” the supply chain-suppliers, distributors, resellers and customers are enabling business-to bus

What are the basic components of dialog program? Screens (Dynpros) Every dialog in an SAP system is controlled by dynpros. A dynpros having of a screen And its flow log

1. Click Tools > General Options, and then click the Object Mapping tab. 2. From the Object type list, select the standard object type that is associated with the object class

Q. Explain logical shift Micro-operations? In logical shift data entering by serial input to left most or right most flip-flop (which depends on right or left shift operations

Q. Explain about parallel programming environment? The parallel programming environment comprises of a debugger, an editor, performance evaluator, programme visualizer for incr

Differentiate between exception and validation testing. - Validation testing is done to test the software in conformance to the needs specified. It aims to demonstrate that the

There is a built-in function function known as cellfun that evaluates a function for each element of a cell array.  Make a cell array, then call the cellfun function, passing the h

Students are needed to work in group of 3 and make an Android mobile application falling under the following categories: Multimedia o    Eg: Camera app, mp3 player, ga

what are the questionnaries and observation of work site for banking system?

Explain about the term E-brokerage briefly. An e-brokerage is an investment house which allows you to buy and sell stocks and acquire investment information through its Web sit