Chapter - 4: The Loop Control Structure

Write a program to produce the following output:


E
Sections
8
Exercises
   1 
  2 3 
 4 5 6
7 8 9 10

#include<stdio.h>
#include<conio.h>
int main()
{
	int i,j,a=4,b=1,k,l=1;
	for(i=1;i<=4;i++)
	{
		for(j=1;j<=a;j++)
			printf(" ");
		a--;
		
		for(k=1;k<=b;k++)
		{
			printf("%d ", l);
			l++;
		}
		b++;
		
		printf("\n");
	}
	getch();
	return 0;
}

© 2020 Garbage Valuegarbage value logo