­
­

Star Rectangle (Filled)

By Developgram - January 10, 2017
/* Summary: Print rectangle pattern of stars. */ #include<stdio.h> int main() { int row, col, n, m; printf("Enter the number of rows: "); scanf("%d", &n); printf("Enter the number of columns: "); scanf("%d", &m); for(row=1; row<=n; row++) { for(col=1; col<=m; col++) printf("* "); printf("\n"); } return 0; } ...

Continue Reading

  • Share:

Star Square (Filled)

By Developgram - January 10, 2017
/* Summary: Print filled square pattern of stars. */ #include<stdio.h> int main() { int row, col, n; printf("Enter the number of rows: "); scanf("%d", &n); for(row=1; row<=n; row++) { for(col=1; col<=n; col++) printf("* "); printf("\n"); } return 0; } ...

Continue Reading

  • Share:

Star Rhombus (Hollow)

By Developgram - January 10, 2017
/* Summary: Print hollow rhombus pattern of stars. */ #include <stdio.h> int main() { int row, col, space, n; printf("Enter the number of rows: "); scanf("%d", &n); for(row=1;row<=n;row++) { for(col=1;col<=(n+1)-row;col++) printf("*"); for(space=1;space<row;space++) printf(" "); for(col=1;col<=(n+1)-row;col++) printf("*"); printf("\n"); } for(row=2;row<=n;row++) { for(col=1;col<=row;col++) printf("*"); for(space=1;space<=n-row;space++) printf(" "); for(col=1;col<=row;col++) printf("*"); printf("\n"); } return 0; } ...

Continue Reading

  • Share:

Star Rhombus (Filled)

By Developgram - January 10, 2017
/* Summary: Print filled rhombus pattern of stars. */ #include <stdio.h> int main() { int row, space, col, n; printf("Enter the number of rows: "); scanf("%d", &n); for(row=1;row<=n;row++) { for(space=row;space<n;space++) printf(" "); for(col=1;col<(row*2);col++) printf("*"); printf("\n"); } for(row=n-1;row>=1;row--) { for(space=n;space>row;space--) printf(" "); for(col=1;col<(row*2);col++) printf("*"); printf("\n"); } return 0; } ...

Continue Reading

  • Share:

Star Rhombus

By Developgram - January 10, 2017
/* Summary: Print rhombus pattern of stars. */ #include<stdio.h> int main() { int row, col, n; printf("Enter the number of rows: "); scanf("%d", &n); for(row=1; row<=n; row++) { for(col=n; col>row; col--) printf(" "); printf("*"); for(col=1; col<(row-1)*2; col++) printf(" "); if(row==1) printf("\n"); else printf("*\n"); } for(row=n-1; row>=1; row--) { for(col=n; col>row; col--) printf(" "); printf("*"); for(col=1; col<(row-1)*2; col++) printf(" "); if(row==1) printf("\n"); else printf("*\n");...

Continue Reading

  • Share:

Star Rectangle

By Developgram - January 10, 2017
/* Summary: Print rectangle pattern of stars. */ #include<stdio.h> int main() { int row, col, n, m; printf("Enter the number of rows: "); scanf("%d", &n); printf("Enter the number of columns: "); scanf("%d", &m); for(row=1; row<=n; row++) { for(col=1; col<=m; col++) { if(row==1 || row==n || col==1 || col==m) printf("* "); else printf(" "); } printf("\n"); } return 0; } ...

Continue Reading

  • Share:

Star Square

By Developgram - January 10, 2017
/* Summary: Print square pattern of stars. */ #include<stdio.h> int main() { int row, col, n; printf("Enter the number of rows: "); scanf("%d", &n); for(row=1; row<=n; row++) { for(col=1; col<=n; col++) { if(row==1 || row==n || col==1 || col==n) printf("* "); else printf(" "); } printf("\n"); } return 0; } ...

Continue Reading

  • Share:

Star Pyramid (Reverse)

By Developgram - January 10, 2017
/* Summary: Print reverse pyramid pattern of stars. */ #include<stdio.h> int main() { int row, col, space, n; printf("Enter the number of rows: "); scanf("%d", &n); for(row=n; row>=1; row--) { for(space=1; space<=n-row; space++) printf(" "); for(col=1; col<=row; col++) printf("* "); printf("\n"); } return 0; } ...

Continue Reading

  • Share:

Star Pyramid

By Developgram - January 10, 2017
/* Summary: Print pyramid pattern of stars. */ #include<stdio.h> int main() { int row, col, space, n; printf("Enter the number of rows: "); scanf("%d", &n); for(row=1; row<=n; row++) { for(space=1; space<=n-row; space++) printf(" "); for(col=1; col<=row; col++) printf("* "); printf("\n"); } return 0; } ...

Continue Reading

  • Share:

Star Triangle Descending (RTL)

By Developgram - January 10, 2017
/* Summary: Print stars in descending order from right to left. */ #include<stdio.h> int main() { int row, col, space, n; printf("Enter the number of rows: "); scanf("%d", &n); for(row=n; row>=1; row--) { for(space=1; space<=n-row; space++) printf(" "); for(col=1; col<=row; col++) printf("* "); printf("\n"); } return 0; } ...

Continue Reading

  • Share:

Star Triangle Descending (LTR)

By Developgram - January 10, 2017
/* Summary: Print stars in descending order from left to right. */ #include<stdio.h> int main() { int row, col, n; printf("Enter the number of rows: "); scanf("%d", &n); for(row=n; row>=1; row--) { for(col=1; col<=row; col++) printf("* "); printf("\n"); } return 0; } ...

Continue Reading

  • Share:

Star Triangle Ascending (RTL)

By Developgram - January 10, 2017
/* Summary: Print stars in ascending order from right to left. */ #include<stdio.h> int main() { int row, col, space, n; printf("Enter the number of rows: "); scanf("%d", &n); for(row=1; row<=n; row++) { for(space=1; space<=n-row; space++) printf(" "); for(col=1; col<=row; col++) printf("* "); printf("\n"); } return 0; } ...

Continue Reading

  • Share:

Star Triangle Ascending (LTR)

By Developgram - January 10, 2017
/* Summary: Print stars in ascending order from left to right */ #include<stdio.h> int main() { int row, col, n; printf("Enter the number of rows: "); scanf("%d", &n); for(row=1; row<=n; row++) { for(col=1; col<=row; col++) printf("* "); printf("\n"); } return 0; } ...

Continue Reading

  • Share: