Filled Under:

C program to print the pattern

 C program to print the pattern

C program to print the pattern

In this program, I have discussed about the C program to print the pattern shown above.


#include<stdio.h>
int main()
{ int i,j,k,l,m,p=1,q=3,z;
for(i=4;i>=1;i--)
{ for(j=1;j<i;j++)
{ printf(" ");
}
for(k=p;k>=1;k--)
{ printf("%d",k);
}
p++;
printf("\n");
}
for(l=1;l<=3;l++)
{ for(z=1;z<=l;z++)
{printf(" ");
}
for(m=q;m>=1;m--)
{ printf("%d",m);
}
q--;
printf("\n");
}

}

Just copy and paste the program in your desired compiler (Dev C++ is more preferable) and run it.

Enjoy programming in C.

0 comments:

Post a Comment

 

Copyright 2020 Programming in C All Right Reserved