design an algorithm that will display to the screen the first 20 numbers, with their squares and cubes, as follows:
#include <iostream>
using namespace std;
int main()
{
cout<<"Number\tSquare\tCube"<<endl;
for(int i=1;i<=20;i++) {
cout<<i<<"\t"<<i*i<<"\t"<<i*i*i<<endl;
}
return 0;
}
Output:
$g++ -o main *.cpp $main Number Square Cube 1 1 1 2 4 8 3 9 27 4 16 64 5 25 125 6 36 216 7 49 343 8 64 512 9 81 729 10 100 1000 11 121 1331 12 144 1728 13 169 2197 14 196 2744 15 225 3375 16 256 4096 17 289 4913 18 324 5832 19 361 6859 20 400 8000
design an algorithm that will display to the screen the first 20 numbers, with their squares...
1. Create the algorithm for the following problem. Considering the first 20 natural numbers, calculate the sum of these numbers, the sum of their squares, and the sum of their cubes. Display all the sums at the end of the solution. Post your response as flowchart or pseudocode.
Can I please have a simple pseudocode algorithm of this problem. 1 Design an algorithm that will read a series of 50 integers at the terminal. The first integer is special, as it indicates how many more integers will follow. Your algorithm is to calculate and print the sum and average of the integers, excluding the first integer, and display these values to the screen.
8. Design a flowchart for sorting the following numbers using "Bubble Sort" algorithm. (20) 74 101 5 [74 10 1 5; N= length of array, a Hints: There are 5 (five) numbers. Let us assume the array, a Start drawing the flowchart as follows: Start For Input ac[74 10 1 5) Length of a False For k-0kcN-2:k-k+1 True 8. Design a flowchart for sorting the following numbers using "Bubble Sort" algorithm. (20) 74 101 5 [74 10 1 5; N=...
Help pls for assignment 2. Write an algorithm to display up to 10 user inputs 3. Write an algorithm to display print first 5 items in a collection. 4. Write an algorithm to read in 3 numbers. Display the largest number.
Write an Algorithm in Pseudocode for the Exercises Below Add 5 numbers that a user enters by keyboard and display the Total on screen. Compute the area of a rectangle and display on screen based on length and width values that the user enters by keyboard. Compute the new price for a product that’s on sale for 10% off. Display new calculated price on screen. Assume current price is $25.00. Add the prices of an order of fries, a burger...
Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in the array and then display the following data: The lowest number in the array The highest number in the array The total of the number in the array The average of the numbers in the array PLEASE GIVE THE PSEUDOCODE AND CODE IN C PROGRAMMING
Write and test a MIPS assembly language program to compute and display the first prime numbers up to n where n is given. Set n to be 19 but the program should work of any value of n. For the program to identify primes, the easiest way is to use the algorithm: for (i = 2; i < x; i++) if ((x % i) == 0) break; //break out, not prime where x is the number you are checking...
Design a simple full-screen editor on a video display terminal. The editor allows text to be inserted, deleted, and modified. Sections of text can be “cut” from one part of the file and “pasted” to another part of the file. The user can specify a text string, and the editor can find the next occurrence of that string. Through the editor, the user can specify margin settings, page length, and tab settings. Then, evaluate the quality of your design.
For a 2-3 tree containing real numbers, design an algorithm for computing the range (i.e., the difference between the largest and smallest numbers in the tree) and determine its worst-case efficiency.
pls help me to write the defining algorithm,pseudo code and desk checking(2 test cases each) Design an algorithm to accept income from the user; compute the income tax to be paid and display the income and the tax payable on the screen. 3. Income tax calculation is based on the following table. It is also available at this link: https://www.iras.gov.sg/irashome/Individuals/Locals/Working-Out-Your-Taxes/Income Tax-Rates/ (12 Marks) Chargeable Income Income Tax Rate (%) Gross Tax Payable (S) First $20,000 Next $10,000 200 First $30,000...