Computer Science, asked by sdiya4346, 1 month ago

C program Input - 3. output 1 232 45654

Answers

Answered by devarchanc
0

C Programming

Question:

   To print the Pyramid Pattern:

     Input: 3

    Output:

          1

          232

          45654

Explanation:

#include<stdio.h>

int main()

{

 int i,j,k=1,l=1,n;

 printf("Enter the number of lines you want to print");

 scanf("%d",&n);

 for(i=1;i<=n;i++)

 {

   l=k;

   for(j=1;j<=i;j++)

     printf("%d",l++);

   k=l--;

   for(j=1;j<i;j++)

     printf("%d",--l);

   printf("\n");

 }  

}

Similar questions