A program that reads in two integers typed on the keyboard

Assignment Help JAVA Programming
Reference no: EM13168292

Write a program that reads in two integers typed on the keyboard and outputs their sum, difference, and product. Must compile correctly in Eclipse. Here is what I have done, but its wrong.

 

#include <iostream.h>

 

public static void main(String args[])

{

int num1,num2;

int sum,diff,prod

 

cout << "Please enter two integers" << endl;

cin >> num1 >> num2;

 

sum  = num1 + num2;

diff = num1 - num2;

prod = num1 * num2;

 

cout << "the sum is        " << sum  << endl;

cout << "the difference is " << diff << endl;

cout << "the product is    " << prod << endl;

 

return 0;

 

}

}

 

 

Reference no: EM13168292

Questions Cloud

Consider implementing subnetting to support three department : Consider implementing subnetting to support three departments within an organization. The three departments P, Q and R need support for 30, 40 and 60 hosts.
Determine a learners level of literacy : What are six learning support strategies that you could implement into your delivery sessions to address your learner's language, literacy and numeracy needs?
Write me a function that finds the smallest item in an array : Write me a function that finds the smallest item in an ArrayBag (by reference) and returns true if the arrayBag is not empty and false otherwise.
Research developmental characteristics of young children : Select an age group of young children (ages 2-8), research developmental characteristics of young children and describe each of the following aspects in your posting. Physical, Intellectual, social, emotional.
A program that reads in two integers typed on the keyboard : Write a program that reads in two integers typed on the keyboard and outputs their sum, difference, and product. Must compile correctly in Eclipse. Here is what I have done, but its wrong.
Discrimination and prejudice : What race in the U. S. is the target of most discrimination and prejudice?
The function should return the day name (''su'',''mo''..etc) : Write the function day(d,m) where m is an integer from 1 through 12 expressing a month, and d is an integer from 1 through 31 expressing the day part of a date in 2014.
Work involving mostly mental activity is called : Work involving mostly mental activity is called:
Write a function comp(d1,u1,d2,u2) : Write a function comp(d1,u1,d2,u2)

Reviews

Write a Review

JAVA Programming Questions & Answers

  Difference between the two following statements

What exactly is the difference between the two following statements and which is preferred, please provide details: 1) frame.setSize(400, 300); // Set JFrame Size

  Java program that will add the corresponding elements

Develop a Java program that will add the corresponding elements of two 1-dimensional arrays X and Y to produce the 1-dimensional array Z. Arrays X, Y, Z have the same dimension [M].

  Write a java program that finds the temperature

Write a JAVA program that finds the temperature that is the same in both Celsius and Fahrenheit

  Write a java program to implement the finite field

Write a program called "GF2.java" to implement the finite field GF(p n ) where p is a prime number and n is a positive integer.  You also need to write four methods to realize "+", "-", "´", and "/".

  Programming exercises

Programming Exercises 1. Write an application named BadSubscriptCaught in which you declare an array of 10 first names. Write a try block in which you prompt the user for an integer and display the name in the requested position.

  Class named person with fields for holding a person''s name

Design a class named Person with fields for holding a person's name, address, and telephone number. Write one or more constructors and the appropriate mutator and accessor methods for the class's fields.

  Design a boolean function named isprime,

A prime number is a number that is only evenly divisible by itself and 1. For example, the number 5 is prime because it can only be evenly divided by 1 and 5. The number 6, however, is not prime because it can be divided evenly by 1, 2, 3, and 6. Des..

  Java program for line item application

This exercise explains you the process of testing and enhancing Line Item application. Open LineItemApp, Validator, Product, LineItem, and ProductDB classes that are in the c:java1.6ch06LineItem directory and review this code.

  Socket programming in java: tcp

In this project we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web server that is capable of processing multiple simultaneous service requests in parallel.

  Program that computes and prints the value of 6!/5! using

Write a Java program that computes and prints the  value of 6!/5! using Scanner.

  The letters of the alphabet a through z

The letters of the alphabet A through Z can be represented in Morse code. Each letter is represented by a combination of up to four dots and/or dashes, as shown below. Use Java to write and run a console-window program that can convert an English ..

  Accepts a string as its parameter and returns an integer

Write a method in java named secondHalfLetters that accepts a string as its parameter and returns an integer representing how many of letters in the string come from the second half of the alphabet

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd