Write a program that displays the cubes of the numbers

Assignment Help C/C++ Programming
Reference no: EM13338779

Repetition Statements

Write a program that displays the cubes of the numbers from 1 to 10. Recall that the cubes of a number is just the number multiplied by itself and then by itself again. Demonstrate your knowledge of both looping structures by writing two procedures to do this. One procedure should be called, cubeFor and the other should be called, cubeDoWhile. Each procedure should take no arguments and return no values. Inside the procedure, simply display a message telling what kind of loop it is using and then use the appropriate loop to display the number, followed by its cubed value.

When you finish writing these two procedures, write a main procedure that will call both cubeFor and cubeDoWhile to show that they work.
Although the output from your program is not required to look this way, it might look something like:

The cubes using a for statement are:
1 1
2 8
3 27
4 64
5 125
6 216
7 343
8 512
9 729
10 1000

The cubes using a do...while statement are:
1 1
2 8
3 27
4 64
5 125
6 216
7 343
8 512
9 729
10 1000

Reference no: EM13338779

Questions Cloud

Design a wide area network : Design a wide area network (WAN) between offices that includes appropriate math calculations to meet the bandwidth.
Find the electric field as a function of r outside sphere : An aluminum wire has a length of 20m and adiameter of 0.0025in. It is connected to a 9.35V battery. The resistivity of aluminium is 2.65x10^-8(ohm(m))a).
Analyze richardson message from multiple perspectives : Analyze Richardson's message from multiple perspectives, focusing on word choice and content
Determine the total force the person must apply : A person is pushing a uniformly-loaded 21.65 kg wheelbarrow along a plank that makes an angle ? = 27.0° with the horizontal. What is the total force the person must apply
Write a program that displays the cubes of the numbers : Write a program that displays the cubes of the numbers from 1 to 10. Recall that the cubes of a number is just the number multiplied by itself and then by itself again.
Find the magnetic vector potential inside and outside a slab : Find the magnetic vector potential inside and outside a slab of thinkness 2a, extending infinitely in x and y directions. Use Coulomb's gauge. J= -J e^-abs(z)/a)
Find the capacitance that satisfies the design criteria : You're designing a speaker, and you want the tweeter to handle almost everything above 1100 Hz, and woofer to handle almost everything below Hz. Find the capacitance that satisfies the design criteria
Write a program to print the permutation : Given an integer n and a permutation of numbers 1, 2 ... , n-1, n write a program to print the permutation that lexicographically precedes the given input permutation.
Create a non-gui based java application : Create a non-GUI based Java application that calculates weekly pay for an employee. The application should display text that requests the user input the name of the employee.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  What is the output

Suppose that x and y are int variables, z is a double variable, and ch is a char variable. Suppose the input statement is.

  Make a game in which you guess a number

Make a game in which you guess a number between two set numbers to find the answer, the game should tell you if you are too low in your guess or too high. For example

  Build a traffic light system - microcontroller system

Build the whole system with 3 RAG units and three puffin crossing units and build a team to work on this mini-project, be careful in selecting your team member.

  Write a program to make the ssds function

Write a program to make the SSDs function as a MM:SS real-time clock. Hint: You must not use a single delay routine for the one second delay because that will not allow for persistence of vision. The displays need to be constantly refreshed during ev..

  Compcets of office apps

Cell Reference is the location of a cell. Cells are located in columns marked by letters, and rows are marked by numbers. Example to reference a cell in column D row 10 you would reference it as D10.

  The user enter the total rainfall for each of 12 months

Write a program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles. The program should calculate and display:the total rainfall for the year,the average monthly rainfall,and the months w..

  Define a function named average grade

Define a function named average grade. This function returns a double and has four double arguments, testi, test2, test3, test4. The return value should be the average, or arithmetic mean of the four arguments.

  Counts the number of numbers between 150 and 200

create a program that counts the number of numbers between 150 and 200. This is what I have so far, but it's not working. It is an array of 500 number, I did not include the array because of obvious reasons.

  Write a program which accepts the total of food and drink

Write a program which accepts the total of food and drink purchased for a restaurant bill as input. The output should be adjusted bill with a sales tax of six percent 6% and a tip (gratuity) of 15%.

  Menu with options to enter student information

Create a program that uses a menu with options to enter student information (name, ID, GPA), print student information, or quit the program. Use data files and FILE pointers to store and print information entered.

  Given the following test scores and grade equivalents

Given the following test scores and grade equivalents, write a function which is passed a score, and returns a letter grade based on the score entered. A number less than 0 or greater than 100 is invalid.

  An expression whose value depends upon the evaluation

Give an example in C++ of an expression whose value depends upon the evaluation order. Show the orders that produce different values and the values they produce. Explain what side effect is the expression contains.

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