Answer to Question #17128 in C++ for julius bueta
wright a program that will display the following pattern,given the value of n.
Example: if n=4,output
*
* *
* * *
* * * *
1
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!
Learn more about our help with Assignments:
C++
Comments
Leave a comment