Question

Include a pseudocode or flowchart of your process. Use a loop structure to write a C++...

Include a pseudocode or flowchart of your process. Use a loop structure to write a C++ program that

A) Finds and displays how many multiples of 8 there are in between 1 to 1000 .

B) Displays all the multiples of 8 between 1 ~ 1000 , separated with commas.

C) Finds and displays the sum of all the multiples of 8 in between 1 to 1000.

Homework Answers

Answer #1

Answer:

C++ code as per your requirement

1)

//header

#include <iostream>

//namespace standard

using namespace std;

//main

int main() {

//intializing the count to 0

int multiplesOfEightCount=0;

//for loop from 1 to1 1000

for(int i=1;i<=1000;i++){

//checking if i is multiple of 8

if(i%8==0){

//if yes increment the count variable

multiplesOfEightCount++;

}

}

//printing to the user

cout<<"There are "<<multiplesOfEightCount<<" of 8 in betweeen 1 to 1000"<<endl;

}

Editor:

output:

B)

Raw code:

//header

#include <iostream>

//namespace standard

using namespace std;

//main

int main() {

//for loop from 1 to1 1000

for(int i=1;i<=1000;i++){

//checking if i is multiple of 8

if(i%8==0){

cout<<i<<",";

}

}

}

editor:

output:

c)

Raw code:

//header

#include <iostream>

//namespace standard

using namespace std;

//main

int main() {

// initialzing sum as 0

int sum=0;

//for loop from 1 to1 1000

for(int i=1;i<=1000;i++){

//checking if i is multiple of 8

if(i%8==0){

sum=sum+i;

}

}

cout<<"The sum of all the multiples of 8 in between 1 to 1000: "<<sum<<endl;

}

Editor:

output:

Hope this helps you! If you still have any doubts or queries please feel free to comment in the comment section.

"Please refer to the screenshot of the code to understand the indentation of the code".

Thank you! Do upvote.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
​​​​​​WRITE FLOWCHART AND PSEUDOCODE ONLY (C++) Write the flowchart and pseudocode for the following program (but...
​​​​​​WRITE FLOWCHART AND PSEUDOCODE ONLY (C++) Write the flowchart and pseudocode for the following program (but not the program itself.) In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sides. ( sidea2 = sideb2 + sidec2 / sideb2 = sidea2 + sidec2 / …..) The program will read three side lengths from a text file, and then print the lengths along with...
Create a program in C++ language, create a flowchart, provide a screenshot of the program and...
Create a program in C++ language, create a flowchart, provide a screenshot of the program and output, and involve looping for your program: Nested loops: Challenge. Write a program that calculates and displays the yearly amount available if $1000 is invested in a bank account for 10 years. Your program should display the amounts available for interest rates from 6% to 12% inclusively, in 1% increments. Use a nested loop, with the outer loop controlling the interest rate and the...
1) Use a loop structure to calculate the sum of all odd numbers from 1 to...
1) Use a loop structure to calculate the sum of all odd numbers from 1 to 15 2) Use a loop structure to calculate the product of all odd numbers from 1 to 9. 3) Write a program to convert US dollars to Bangaldeshi taka
Please write variables and program plan (pseudocode) of the C++ programming below: #include <iostream> #include <cmath>...
Please write variables and program plan (pseudocode) of the C++ programming below: #include <iostream> #include <cmath> using namespace std; void divisors(int num); int main () {    char repeat;    int num;       while (repeat !='n')    {        cout << "Enter a number: ";        cin >> num;        divisors(num);        cout << "Continue? (y or n): ";        cin >> repeat;    }    return 0; } void divisors(int num) {   ...
C programming 3. Write a do-while loop that displays: 0,10,20,30,40 4.Write nested for loops that displays...
C programming 3. Write a do-while loop that displays: 0,10,20,30,40 4.Write nested for loops that displays three rows of asterisks: ***** ***** ***** 5. Write a complete program that reads a set of integers using scant() until a sentinel value of -99 is read. Once that value is read, display the sum of the value read, exclusive of the -99. 6.Write a procedure(function, method named times10() that accepts an integer argument and displays the result of multiplying the argument by...
In C++ Please, In the main(), below, write a program that prompts for (1) how many...
In C++ Please, In the main(), below, write a program that prompts for (1) how many values to sum, and then (2) uses a summing loop to prompt for and add up 5 numbers. #include <iostream> #include <iomanip> using namespace std; int main() { < your answer goes here> return 0; }
In this example you are allowed to use from the C standard library only functions for...
In this example you are allowed to use from the C standard library only functions for input and output (e.g. printf(), scanf()) Complete the following functions using C programming language: intQ1_for() intQ1_while() intQ1_do() To compute the sum of all numbers that are multiples of 4, between 30 and 1000, in 3 different ways: with a for loop, a while loop and a do-while loop, accordingly. After each loop print the value. Return the total sum at the end of each...
Function Example: Write a Python function that receives two integer arguments and writes out their sum...
Function Example: Write a Python function that receives two integer arguments and writes out their sum and their product. Assume no global variables. def writer(n1, n2): sum = n1 + n2 product = n1*n2 print("For the numbers", n1, "and", n2) print("the sum is", sum) print("and the product is", product) ... 1) Create a PYHW2 document that will contain your algorithms in flowchart and pseudocode form along with your screen shots of the running program. 2) Create the algorithm in both...
Use C++ only. 1) Write a full program that will take a list of years and...
Use C++ only. 1) Write a full program that will take a list of years and it will check if they are leap years. As soon as the program finds the first leap year from the list, the program terminates. The program also terminates when it reads a -1. Please make use of the do . . . while loop structure and the break statement. Example of sample runs: Enter a list of years: 1841 1854 1862 1875 1879 1892...
Write a program in C that calculates: n! = n*(n-1)*(n-2) ...3 ...2 ...1 Use for loop...
Write a program in C that calculates: n! = n*(n-1)*(n-2) ...3 ...2 ...1 Use for loop and while loop
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT