For Loop

Pages: 12
no. not at all. Actually I want to take below output.
xxxxx
xxxx
xxx
xx
x
Last edited on
Ok. This is right:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
using namespace std;

int main()
{
    for (int x=0; x < 5; x++)
    {
        for (int y=0; y <= (5-x) ; y++)
        {
            cout << 'x';
            }
            cout << "\n";
        }

    return 0;
}
Thats worked. Thanks.
Topic archived. No new replies allowed.
Pages: 12