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

  Write the code required to analyse and display

Engineer for a materials manufacturing research lab and have been asked to provide an automated solution to analyse data.

  Create class to calculate perimeter and area rectangle

Create class Rectangle. The class has attributes length and width, each of which defaults to 1. It has read-only properties that calculate the Perimeter and the Area of the rectangle.

  Program that asks for user-s age

Write a program that asks for user's age. Based on their response print "You can vote" (18 years old or older) or "You can't vote".

  Program to simulate rolling one die

Write a program which simulates rolling one die using the following steps: Prompt the user for the number of sides on the die.

  Program to overload the addition assignment operator

Overload the addition assignment operator (+=), the subtraction assignment operator (-=), and the multiplication assignment operator (*=).

  Prolog program to reads employee-s number

Write a prolog program that reads an employee's number from the keyboard, number of hours worked and an hourly rate of pay.

  C program to accept three numbers inputs by user

Write down C program to accept three numbers input by a user, and outputs a table of temperatures in Fahrenheit, Celsius, and Kelvin.

  Write statement essential to call compute interest method

Write statement essential to call the calculate interest method with an account balance of $2300.00 and an interest rate of 5%. What rule must be adhered to when calling a method with multiple parameters?

  Program to calculate integer part of quotient

Calculate the integer part of the quotient when integer a is divided by integer. Calculate the integer remainder when integer a is divided by integer b

  Write program-compute average using floating-point numbers

Write a program that will accept as input between 2 and 25 numbers and then calculate the average of the numbers. Make sure you use floating-point numbers in case the average is not a whole number.

  Create a menu type form that gives user to select subforms

Create a menu type form that provides the user the capability to select one of the following two subforms. Means of selection is programmers choice.

  Write application for university admissions office

Write an application for a university admissions office. Prompt the user for a student's High School Grade Point (for example 3.2) and an admission test score (value from 0 to 100).

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