Answer to Question #17128 in C++ for julius bueta

Question #17128
wright a program that will display the following pattern,given the value of n.
Example: if n=4,output
*
* *
* * *
* * * *
1
Expert's answer
2012-10-25T10:38:20-0400
#include<iostream>

#include<conio.h>

using namespace std;

void main()

{

int i,j,k,n;

printf("Enter the value of n: ");

scanf("%d",&n);

for(i=1;i<=n;i++)

{

for(k=1;k<=n-i;k++)

printf(" ");




for(j=1;j<=2*i-1;j++)

{

printf("*");

}

printf("
");

}

_getch();

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS