Write a program that loops ten times to print the numbers 1 through 10, with three spaces between each. You?

Write a program that loops ten times to print the numbers 1 through 10, with three spaces between

each. Your display should look similar to the example below. NOTE: Your program must use looping!

In other words, do not simply use a single cout statement to simply print the line.

1 2 3 4 5 6 7 8 9 10 <-- There are 3 spaces after the 10.

3 Answers

Relevance
  • 8 years ago
    Favorite Answer

    include <iostream>

    using namespace std;

    int main(void)

    {

    for (int i=1; i<11; i++)

    {

    cout << "\n";

    for (int j=1; j<11; j++)

    {

    cout << j << " ";

    }

    }

    }

    Source(s): IT major, much smarter than the other idiots who post code on here, plus ive done your homework before
  • roger
    Lv 7
    8 years ago

    include <iostream>

    int main(void){

    for(int p=1;p<11;p++)

    cout << p << " ";

    return 0;

    }

  • 8 years ago

    include <stdio.h>

    int main()

    {

    int x;

    for(x = 0; x < 10; x++) {

    printf( "%d", x);

    }

    } /*or something like that, I don't really care.*/

Still have questions? Get your answers by asking now.