Answer to Question #13831 in C++ for Darryl kaye Sanga

Question #13831
Write a program that will display the following pattern, given the value of n.
example: if n=4, output
*
**
***
****
1
Expert's answer
2012-08-30T11:46:25-0400
#include<stdio.h>
#include<conio.h>
int main()
{
int num,r,c;
printf("Enter loop repeat number(rows): ");
scanf("%d",&num);
for(r=1; num>=r; r++)
{
for(c=1; c<=r; c++)
printf("*");
printf("
");
}
getch();
return 0;
}

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