Warning: mysqli_connect(): (HY000/2002): Connection refused in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 38

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 40

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 41

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 45

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 48

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 49
c program for Star Pattern - Get Program Code
Home / C / c program for Star Pattern

c program for Star Pattern

c program for Star Pattern

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

Also see : Alternate Java program for pattern#6

#include<stdio.h>
int main()
{
int n,i,j;    //  initialize the variables
printf("Enter the number of rows in the pattern : ");
scanf("%d",&n);     // number of rows to be printed.
for(i=1;i<=n;i++)    // loop for number of rows in pyramid
{
for(j=1;j<=n-i;j++)     //  loop for spaces
printf(" ");   // printing the space
for(j=1;j<=i;j++)  // loop for  printing  the stars at 1st part of triangle
printf("*");
for(j=1;j<i;j++)   // loop for printing the 2nd triangle
printf("*");
printf("n");    // next line
}
return 1;
}

OUTPUT :

output for patternstar#6

Check Also

Restrict Mouse Pointer Position C Graphics Program

This C Program will restrict the Mouse Pointer location or to a particular position or x,y ...

Leave a Reply

Your email address will not be published. Required fields are marked *

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.