Popular posts from this blog
print diamond of alphabets Pattern Using C
//pattern #include<stdio.h> int main() { int h,i,j; printf("Enter the height"); scanf("%d",&h); for(i=1;i<=h;i++) { for(j=1;j<20-i;j++) printf(" "); for(j=1;j<=i;j++) printf("%c ",64+j); for(j=j-2;j>=1;j--) printf("%c ",64+j); printf("\n"); } for(i=h-1;i>=1;i--) { for(j=1;j<20-i;j++) printf(" "); for(j=1;j<=i;j++) printf("%c ",64+j); for(j=j-2;j>=1;j--) printf("%c ",64+j); printf("\n"); } }
star in diamond shape Pattern using C
//Pattern #include<stdio.h> int main() { int h,i,j; printf("Enter the height"); scanf("%d",&h); for(i=1;i<=h;i++) { for(j=1;j<40-i;j++) printf(" "); for(j=1;j<=i;j++) printf("* "); printf("\n"); } for(i=h-1;i>=1;i--)//4, 3 { for(j=1;j<40-i;j++)//32 printf(" "); for(j=1;j<=i;j++)//j=1..4 ----- 1..3 ------ 1..2 --- 1..1 printf("* "); printf("\n"); } }

Comments
Post a Comment