Accountancy, asked by rlakshmisreya2244, 1 year ago

*
* *
* * *
* * * * Write a c program using for loop

Answers

Answered by tiger009
0

Pattern by C Programming Language

Output:

*

*   *

*   *   *

*   *   *   *

Explanation:

//set header file

#include <stdio.h>

//define main method

int main()

{//set integer data type variables

 int r, c;

 //set for loop for row

 for (r = 1; r <= 4; r++)

 {//set for loop for column

   for(c = 1; c <= r; c++)

   //print pattern

     printf("*\t");

   //break line

   printf("\n");

 }

 return 0;

}

Following are the description of the program:

  • Set required header file and define main method, inside the method.
  • Set two integer data type variables that is 'r' and 'c'.
  • Then, set two for loop in which the first for loop is for the row and the second one is for the column.
  • Finally, we print the pattern in the given format by breaking the line

Learn More:

brainly.in/question/5640776

Similar questions