Skip to content

Instantly share code, notes, and snippets.

@djnotes
Created May 2, 2024 07:29
Show Gist options
  • Save djnotes/27bcbb9fdeec261bee8a771761cec8b3 to your computer and use it in GitHub Desktop.
Save djnotes/27bcbb9fdeec261bee8a771761cec8b3 to your computer and use it in GitHub Desktop.
C Program to Draw Khayam-Pascal Triangle
/**
C Program to draw Khayam-Pascal Triangle
Copyright (C) 2024 Mehdi Haghgoo
*/
#include<stdio.h>
#define COLS 80
#define ROWS 40
int main(){
int i,j;
int spaces;
int stars;
for (i = 0; i < ROWS; i++){
for(spaces = 0; spaces < COLS/2 - i; spaces++){
putchar(' ');
}
for(stars = 0; stars < 2 * (COLS/2 - spaces) - 1; stars++){
putchar('*');
}
putchar('\n');
}
getchar();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment