make and run a program that will display the output below

#####
####
###
##
#

it should use forloops,, i cant make one, but the code is long.

i cant make it work

also, you need to use the concept of rows and columns

heres mine,, its epic fail
pls help me

#include<iostream>

using namespace std;

int main()
{
	int row;

	for(row=1; row<=5; row++)
	{cout<<"#";
	cout<<'/n';
	for(row=1; row<=4; row++)
	cout<<"#";
	cout<<'/n';
	for(row=1; row<=3; row++)
	cout<<"#";
	cout<<'/n';
	for(row=1; row<=2; row++)
	cout<<"#";
	cout<<'/n';
	for(row=1; row<=1; row++)
	cout<<"#";
	cout<<'/n';
	}
	system("pause");
	return 0;
}

You will need nested for loops:

for(over each of the rows)
{  
   for(over each of the columns)
   {

Find a relationship between the columns and the rows. Take another crack at it, and post back with your updated code.

yeah i don't know...i just learned loops last week..and i bombed my assignment..got a big fat zero..so good luck!

After writing for and cout 5 times, you should have understood the need of nested loop.

If you want to loop over something, the syntax is as following:

int rowVector[5]; // Initializing

for (int i = 0; i < 5; i++)
{
 rowVector[i] = i;
 cout << rowVector[i]; 
}

Initializing an array with both rows and columns is done as following:

arrar[number_of_rows][number_of_columns]

Hope I didn't give you too much help there.

Cheers,
Erik

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.