#1: C program to print pyramid pattern of n stars

  1. #include <stdio.h>
  2. //c program to print pyramid pattern of numbers
  3. // www.instanceofjava.com
  4. int main(){
  5.    int number,k,m;

  6.     printf("Number of lines of star pattern  ");
  7.     scanf("%d", &number);

  8.     printf("\n");

  9.     for(  k = 1; k <= number; k++ )
  10.     {
  11.         for( m = 1; m <= k; m++)
  12.         {
  13.             printf("*");
  14.         }
  15.         printf("\n");
  16.     }

  17.    getch();
  18. }

Output:
pattern program in c language



#2: C program to print pyramid pattern of n Numbers

  1. #include <stdio.h>
  2. //c program to print pyramid pattern of numbers
  3. // www.instanceofjava.com
  4. //pyramid pattern in c
  5. //write a c
  6.  program to print following pattern
  7. int main(){
  8.    int number,k,m;

  9.     printf("Number of lines of star pattern  ");
  10.     scanf("%d", &number);

  11.     printf("\n");

  12.     for(  k = 1; k <= number; k++ )
  13.     {
  14.         for( m = 1; m <= k; m++)
  15.         {
  16.            printf("%-5d ", m);
  17.         }
  18.         printf("\n");
  19.     }

  20.    getch();
  21. }

Output:

pyramid pattern in c


Instance Of Java

We are here to help you learn! Feel free to leave your comments and suggestions in the comment section. If you have any doubts, use the search box on the right to find answers. Thank you! 😊
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu