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
(a) Why did SAP introduce the extended star schema? Explain why it is reported to be better than the traditional schema model? (b) What is the difference between a dimension use

To sktech the circles in the visualization, you need to use the paramteric equation of a circle (x = r cos (Θ), y = r sin(Θ). A circle can be shown as a polygon where the points of

Determine the Example - "fork-join" module initial_fork_join(); reg clk,reset,enable,data; initial begin $monitor("‰g clk=‰b reset=‰b enable=‰b data=‰b", $time, cl

A protocol is a formal description of message formats and the rules two or more machines must follow to exchange those messages. Because TCP (transmission control protocol) and IP

Q. Explain fundamental instruction set characteristics? Let's look into a number of fundamental instruction set characteristics: The operands can be addressed in memory,

General principles of pruning: The general principles are such that: 1. Given a node N that can be chosen by player one, thus if there is another node, X, along any path,

How the temperature effecting the delays in a chip The delays are directly proportional to the temperature. As the temperature enhances the delays are enhances and chip wil

how can we design a multiplier by using ASM chart and then design the data controller ?!!

PD controller Student should aim for Kp and Kd value that will minimize the steady error with improved rise time and settling time. The amount of over shoot should not be more t

What is program-controlled I/O? In program controlled I/O the processor repeatedly checks a status flags to achieve the needed synchronization among the processor and an input