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
Q. Explain Assembly program execution? An assembly program is written according to a strict set of rules. A word processor or editor is used for keying an assembly program in t

Q. What are intelligent agents? What tasks will they perform? ANSWER: Intelligent agents are software that helps you, or operate on your behalf, in performing repetitive comput

A minterm is an AND expression involving all input variables in either inverted or non-inverted form.For one particular row the associated mintermis the only minterm which equals l

Instruction 1. You can do this individually or in groups of 2-3 students. 2. Any material copied and pasted from anywhere (e.g., figures and text) is considered plagiarism even

Explain the role of a bus arbiter in a multiprocessor configuration. Bus arbiter: Which functions to resolve priority between bus masters and allows only one device at a time t


Question 1 Explain the functional units of a basic computer with a neat diagram 2 What do you mean by addressing modes? List the different types of addressing modes 3 Exp

Explain about the term- Reports Reports are produced as a result of questions like "how many times has a type of car broken down" or "which cities have the highest house price

Different EDI components and services  Three main components containing services in EDI System are as follows:  •  Application Service: Gives the means of integrating existi

what are the different types of tablets?