Pattern Practice in C Programming


Pattern  C codes
ffff*ffff
fff***fff
ff*****ff
f*******f
*********
Image result for c programming

Solution:
#include<stdio.h>
int main()
{
int i,j,n;
scanf("%d", &n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n-i;j++)
{
printf("f");
}
for(j=1;j<=2*i-1;j++)
{
printf("*");
}
for(j=1;j<=n-i;j++)
{
printf("f");
}
printf("\n");
}
return 0;
}

No comments