We can make different pattern by using c programming. Here is a code of pyramid pattern.............
#include <stdio.h>
int main()
{
int i,j,k,l,m;
scanf("%d",&i);
m=i;
for(j=1;j<=i;j++)
{
for(k=1;k<=m;k++)
{
printf(" ");
}
for(l=1;l<=j;l++)
{
printf("*");
printf(" ");
}
printf("\n");
m--;
}
return 0;
}
#include <stdio.h>
int main()
{
int i,j,k,l,m;
scanf("%d",&i);
m=i;
for(j=1;j<=i;j++)
{
for(k=1;k<=m;k++)
{
printf(" ");
}
for(l=1;l<=j;l++)
{
printf("*");
printf(" ");
}
printf("\n");
m--;
}
return 0;
}
0 comments:
Post a Comment