what is the source code having an output of
1
21
321
using for loop statement in microsoft visual c++?

it must be right aligned

Anuradha Mandal commented: Try something by ownself. +0
Onlineshade commented: No coding!!!!!! -1
Re: for loop 80 80
#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{
	int i,j,k;

	for ( i=1; i<5; i++ )
	{
		for ( j=0,k=i ; j<i ; j++,k--  )
		{
			cout << k;
		}
		cout << "\n";
	}

	char f;cin>>f;
	return 0;
}

Is this good for you, or did you wanted something else?

commented: Way to go! Now he doesn't have to think nor learn how to program! Good job! -4
commented: Do not give code directly.Please give a chance him to try some code. +0
commented: You forgot to ask if he wants fries with that. -4
commented: dont do home Work for others +0
commented: Dont directly post the code. Please! -1
Re: for loop 80 80

No it's not good. Doing his homework for him is NOT good. It's called cheating, something we try to avoid on these forums.

Re: for loop 80 80

No it's not good. Doing his homework for him is NOT good. It's called cheating, something we try to avoid on these forums.

Just thought it would be easier if i show the guy how its done and then if he really likes what hes doing, he would try and understand how i did that himself. But yeah, i get the point, it was stupid of me to do it for him, thanks for informing me. :)

Re: for loop 80 80

nuclear

You are right doing homework is not the task of us. We will discuss our programming problems.

Re: for loop 80 80

Hello 3YEARS,
Do you have any idea abot how to print a pyramid of "*"?
*
**
***
****

Re: for loop 80 80

The logic of your actual post is almost same to print pyramid. Please do some coding.

commented: Don't make a second post when you can edit your first post! -4
Re: for loop 80 80

One thing I can say that you will need two for loops for printing it.

Be a part of the DaniWeb community

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