Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(triangle -printed program) write a programe that prints the following patterns

ID: 3544408 • Letter: #

Question

(triangle -printed program) write a programe that prints the following patterns separatly one beloww the other  use for loops tto generat the patterns, all asterisks (*)should be printed by a single printf statement of the form printf (  "%s", "*"); (this casuses the asterisks to print side by side) .

A)                   B)
*                     **********

**                    *********
***                   ********

****                  *******

*****                 ******
******                *****
*******              ****
********            ***
*********           **
**********         *
C)                         D)
**********         *
*********          **
********            ***
*******              ****
******                *****
*****                  ******                     
****                    *******
***                      ********
**                        *********
*                          **********

Explanation / Answer

#include<stdio.h>

int main()

{

int i,j;

for(i=0;i<10;i++)

{

for(j=0;j<12;j++)

{

if(j==i+1)printf(" ");

else printf("%s","*");

}

printf(" ");

}

printf(" ");

for(i=0;i<10;i++)

{

for(j=0;j<12;j++)

{

if(j==10-i)printf(" ");

else printf("%s","*");

}

printf(" ");

}

return 0;

}