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

Onlineshade commented: No coding!!!!!! -1
Anuradha Mandal commented: Try something by ownself. +0
#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: Dont directly post the code. Please! -1
commented: dont do home Work for others +0
commented: You forgot to ask if he wants fries with that. -4
commented: Do not give code directly.Please give a chance him to try some code. +0
commented: Way to go! Now he doesn't have to think nor learn how to program! Good job! -4

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.

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. :)

nuclear

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

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

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

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