Write program using to take input two integers by while loop

Assignment Help Programming Languages
Reference no: EM1366776

Write a program that uses while loops to perform the following steps:
1. Prompts the user to input two integers: firstNum and secondNum. (firstNum must be less than secondNum).
2. Outputs all the odd numbers between firstNum and secondNum.
3. Outputs the sum of all the even numbers between firstNum and secondNum.
4. Outputs all the numbers that when squared are between 1 and 10. So if firstNum is greater than
3 there won't be any numbers that when squared are between 1 and 10.
5. Output the sum of the squares of all the odd numbers between firstNum and secondNum.
Some sampe output may look as follows:
Enter firstNum: 2
Enter secondNum: 12
Odd numbers between 2 and 12 are 3, 5, 7, 9, 11
Sum of the even numbers between 2 and 12 = 42
Numbers that when squared are between 1 and 10: 2, 3
Sum of squares of all odd numbers between 2 and 12 = 285

Reference no: EM1366776

Questions Cloud

Design user-s requirements specification for school : Design a user's requirements specification for the EasyDrive School of Motoring database system. Use a single major user view for the application (Director View)
Determining inverse demand function : Suppose M = $80,000, PR = $30, T = 5, PE = $12, and N = 6,000. Using these, compute and write the direct demand function for Good A. Show your math. Watch the decimals! The coefficient on M is 0.02 and the coefficient on N is .4
Good patient experience and bad patient experience : Most of us have either been patients, or had family members who were patients, in a number of health care facilities. What differentriates a good patient experience from a bad patient experience?
Price and quantity of equilibrium : Discuss if you agree or disagree with this statement and explain your position: Market equilibrium (price and quantity of equilibrium) is just a theoretical result.
Write program using to take input two integers by while loop : Write a program which uses while loops to perform following steps: Prompts user to input two integers: firstNum and secondNum. (firstNum must be less than secondNum).
Question on fundamentals of managerial finance : The Beasley Company has been experiencing declining earnings, but has just declared a 50% salary rise for its top executives. A dissident group of shareholder wants to oust the existing board of directors.
Rising cost of healthcare effect : How does the rising cost of healthcare effect each class of American society. What can Americans do to ensure that the climbing cost of healthcare remains affordable for everyone?
Different kinds of healthcare agencies : Describe the various kinds of healthcare agencies, and how they appear and are employed by members of popular networking sites.
Graphing the events of labor market : Describe the effect of each of the following events on the market for labor in the computer manufacturing industry. Use graphs.

Reviews

Write a Review

Programming Languages Questions & Answers

  Design the logic for application for company

Design logic for an application for company which wants a report containing a breakdown of payroll by department. Input includes each employee's last name, first name, department number.

  Program read weight of package of breakfast cereal in ounces

Write a program which will read the weight of package of a breakfast cereal in ounces and output weight in metric tons as well as number of boxes

  Write stored function that takes in zipcode as parameters

Write a stored function called zip_exist that takes in a zipcode.zip%Type parameter and returns a Boolean. The function will return TRUE if the zipcode passed into it exists.

  Different class maintain programming programs are organized

It allows different classes to maintain programming so that programs are kept more organized. Object orientation also allows a programmer to use the same objects in different programs. Response?

  Program to divide string based on some delimiter string

StringTokenizer is a class in the java.util library that can divide a String based on some delimiter String (a delimiter is a separator). If the instruction StringTokener st = new StringTokenizer.

  Program to create professor rating class

Write down program to create Professor Rating class comprising of professor ID and three ratings. Three ratings are utilized to estimate easiness.

  Program to read list up to hundred addresses

efine a class called address_t with members for the four integers. Your program should read a list up to 100 addresses and nicknames terminated by a sentinel address of all zeros and nickname.

  Design-write program to enter score repetition structure

Design and write a program that asks the user to enter five test scores using a repetition structure. The program should display the letter grade for each score and the average test score at the end of the program.

  Create class to store the product name

Choose a fruit or vegetable product that you might commonly find at the farmers market (for example, tomatoes, potatoes, lettuce, apples, cantaloupes, etc). Create a class that stores the product name.

  Create new method for random turning

Create new method named randomTurn (this method has no parameters and returns nothing). Select the code that does the random turning.

  Create logic for program to count readers by genders

Create the logic for a program that would produce a count of readers by gender within age group - that is, under 20 females, under 20 males, etc.

  Ruby program that continuously reads in number

Write down Ruby program that continuously reads in number, x, from screen, and then calculates and displays its: factorial, if x is less than 15.

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