0% found this document useful (0 votes)
28 views

#Include Void Main (Int I, J, K, L For (I 1 I 1 K - ) Printf (" ") For (J I J 2 I-2 L - ) Printf ("%D",L) Printf ("/N") )

This C program contains nested for loops to print a pyramid pattern of numbers. It initializes 4 integer variables and uses a outer for loop with counter i from 1 to 4. An inner for loop with counter k prints spaces from 4-i to 1. Two additional inner for loops with counters j and l print ascending then descending numbers from i to 2i-1 and back to create each line of the pyramid, with a new line printed at the end.

Uploaded by

Ashish Jog
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

#Include Void Main (Int I, J, K, L For (I 1 I 1 K - ) Printf (" ") For (J I J 2 I-2 L - ) Printf ("%D",L) Printf ("/N") )

This C program contains nested for loops to print a pyramid pattern of numbers. It initializes 4 integer variables and uses a outer for loop with counter i from 1 to 4. An inner for loop with counter k prints spaces from 4-i to 1. Two additional inner for loops with counters j and l print ascending then descending numbers from i to 2i-1 and back to create each line of the pyramid, with a new line printed at the end.

Uploaded by

Ashish Jog
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <stdio.

h>
void main()
{
int i,j,k,l;
for(i=1;i<=4;i++)
{
for(k=4-i;k>=1;k--)
printf(" ");
for(j=i;j<=2*i-1;j++)
printf("%d",j);
for(l=i;l>=2*i-2;l--)
printf("%d",l);
printf("\n");
}

You might also like