Question

Can someone help me fix this program? //SwatTheBugs22.cpp - displays the following pattern of numbers //2...

Can someone help me fix this program?

//SwatTheBugs22.cpp - displays the following pattern of numbers

//2 4 6

//8 10 12

//14 16 18

//20 22 24

//Created/revised by Brandon Tousignant on November 30, 2018

#include <iostream>

using namespace std;

int main()

{

int number = 0;

for (int outer = 1; outer < 5; outer =+ 1)

{

for (int inner = 1; inner < 4; inner += 1)

number += 2;

cout << number << " ";

//end for

cout << endl;

} //end for

return 0;

} //end of main function

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>

using namespace std;

int main()

{

int number = 0;

for (int outer = 1; outer < 5; outer++)
{
for (int inner = 1; inner <4; inner +=1)
{
number += 2;

cout << number << " ";
}


//end for

cout << endl;

} //end for

return 0;

} //end of main function

2 4 6 8 10 12 14 16 18 20 22 24 Process returned 0 〈0x0〉 execution tine : 0.019 s Press any key to continue

Add a comment
Know the answer?
Add Answer to:
Can someone help me fix this program? //SwatTheBugs22.cpp - displays the following pattern of numbers //2...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What does the following program print? I // Exercise 3.12 Solution: ex03_12.cpp // What does this...

    What does the following program print? I // Exercise 3.12 Solution: ex03_12.cpp // What does this program print? #include <iostream> using namespace std; 3 4 7 int main() { int y; // declare y int x = 1; // initialize x int total = 0; // initialize total while ( 10 ) // loop 10 times y = X* X; // perform calculation cout << y << endl; // output result total += y; // add y to total ++x;...

  • Follow the instructions for starting C++ and viewing the Intermediate23.cpp file, which is contained in either...

    Follow the instructions for starting C++ and viewing the Intermediate23.cpp file, which is contained in either the Cpp8IChap11\Intermediate23 Project folder or the Cpp8\Chap11 folder. (Depending on your C++ development tool, you may need to open the project/solution file first.) The program uses an array to store the amount of money a game show contestant won in each of five days. The program should display the total amount won and the average daily amount won. It should also display the day...

  • A) Fix any errors to get the following program to run in your environment.               B)...

    A) Fix any errors to get the following program to run in your environment.               B) Document each line of code with comments and describe any changes you had to make to the original code to get it to work. C) Write a summary of what your final version of the program does. You may also add white space or reorder the code to suit your own style as long as the intended function does not change. Program 3 #include...

  • What am I doing wrong here...…. Question is this : In this exercise, you will create...

    What am I doing wrong here...…. Question is this : In this exercise, you will create a program that displays a table consisting of four rows and three columns. The first column should contain the numbers 10 through 13. The second and third columns should contain the results of squaring and cubing, respec- tively, the numbers 10 through 13. The table will look similar to the one shown in Figure 9-38. If necessary, create a new project named Introductoryl6 Project,...

  • C++ Type in the above program . Before running the program, change each of the question...

    C++ Type in the above program . Before running the program, change each of the question marks to the numbers 1 through 5 indicating the order in which that line will be executed. Run the program and check your numbers. Fix and rerun if necessary. Submit the program and the output. #include <iostream> using namespace std; //prototypes void DemonstrateProc1(); void DemonstrateProc2(int num); int main() { cout << "?. Execution starts with main. " << endl; DemonstrateProc1();       cout << "?....

  • 15.6: Fix the code to print the count from 1 to x (to loop x times)...

    15.6: Fix the code to print the count from 1 to x (to loop x times) #include <iostream> // include the header file using namespace std; void count(int x){    for(int i=1; i<=x; i++){ cout<<x; } } int main(){    int x,i;    cin >> x; count(x);    return 0; } 15.7 Fix the nested for loops to print the count from 1 to x twice, e.g. "12....x12.....x" #include <iostream> // include the header file using namespace std; int main(){...

  • When I run this code use ./main How to fix it when program reminds segmentation fault...

    When I run this code use ./main How to fix it when program reminds segmentation fault (core dumped)? #include <iostream> void set_num(int* i_prt, int num) { *i_prt = num; } int main(int argc, char** argv) { int x; set_num(&x, 13); std::cout << "x: " << x << std::endl; int* y; set_num(y, 4); std::cout << "*y:" << *y << std::endl; }

  • Do not change anything in the supplied code below that will be the Ch12_Ex9.cpp except to...

    Do not change anything in the supplied code below that will be the Ch12_Ex9.cpp except to add documentation and your name. Please use the file names listed below since your file will have the following components: Ch12_Ex9.cpp given file //Data: 18 42 78 22 42 5 42 57 #include <iostream> #include "unorderedArrayListType.h" using namespace std; int main() { unorderedArrayListType intList(25);     int number;     cout << "Enter 8 integers: ";     for (int count = 0; count < 8; count++)...

  • C++ Fix the errors in the following code. (Not all errors are syntax related) #include <iostream>...

    C++ Fix the errors in the following code. (Not all errors are syntax related) #include <iostream> using namespace std; int main() { //Part A int numA numA = 10; cout << numA << end; /* Part B */*/ int numB = numA; cin >> usrInput; int usrInput = 0; numB = numB + usrInput; cout << numB <"/n";    /* Part C */ int numC = 10000000000; cout << numC << endl; return 0; }

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT