In this i will show you way to make a interesting pyramid shape by using C programming language.
The c code is given bellow.I use nested loop to create this.
#include<stdio.h>
int main(void)
{
int i,j,l;
int k=1;
for(i=1;i<=9;i++)
{
for(j=1;j<=i;j++)
printf("%d ",k%10);
if(j>=i)
printf("\n"),k++;
}
}
The c code is given bellow.I use nested loop to create this.
#include<stdio.h>
int main(void)
{
int i,j,l;
int k=1;
for(i=1;i<=9;i++)
{
for(j=1;j<=i;j++)
printf("%d ",k%10);
if(j>=i)
printf("\n"),k++;
}
}
No comments:
Post a Comment