Get premium membership and access questions with answers, video lessons as well as revision papers.

Using a nested loop write a C program which should print the following result

      

Using a nested loop write a C program which should print the following result
*
**
***
****
*****
******
*******
********
*********
**********
**********
*********
********
*******
******
*****
****
***
**
*

  

Answers


Anthony
#include
int main()
{
int a, b;
for ( a=0; a<10; a++)
{
for (b=0; b<=a; b++)
printf("*");
printf("\n");
}
for ( a=0; a<10; a++)
{
for (int b=9; b>=a; b--)
printf("*");
printf("\n");
}
return 0;
}
anmwat answered the question on November 17, 2017 at 06:38


Next: What are the circumstances which may lead to developing of a new information system
Previous: A school intends to setup an e-learning system, list three problems that are likely to be encountered.

View More Computer Science Questions and Answers | Return to Questions Index


Learn High School English on YouTube

Related Questions