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. Convert the following into POS form 1.  (AB + C + DC)(AB + BC + D) 2.  WYZ + XYZ + W'X'Y + W'XYZ 3.  XY + XZ + X'YZ' 4.   (A+B'+C) (AB+AC') 5.   F(A,B,C,D)=M(0,3,

Predicates in first-order logic sentences - artificial intelligence There are predicates first and foremost in first-order logic sentences. These are indications that some thin

Q. Program for encoding ASCII Alpha numeric? ; A program for encoding ASCII Alpha numeric. ; ALGORITHM:             ; create the code table             ; read an input

Pros and Cons of Assembly Language The following are a number of advantages / disadvantages of employing assembly language: Assembly Language offers more control over ha

Q. Functions for MPI Environment? Int MPI_Finalize (void) It ends the MPI environment. Any MPI function cannot be called after MPI_Finalize. Each MPI process belongs to on

What are the methods for handling deadlocks?  The deadlock problem can be dealt with in one of the three ways:  a. Use a protocol to prevent or avoid deadlocks, make sure th

How would you implement inheritance using VB.NET/C#? When we set out to execute a class using inheritance, we must first start with an existing class from which we will derive

What are the four significant factors that led to the development of open source software? 1. To diminish the high control value of the Proprietary Software 2. To avoid disc

What are the risks by financial service provider's perspective in Electronic Payment Systems? Through the financial service provider's perspective: • Stolen service or c

Define pipelining Pipelining is an efficient way of organizing concurrent activity in a computer system. The processor implements the program by fetching and implementing instr