Created
May 2, 2024 07:29
-
-
Save djnotes/27bcbb9fdeec261bee8a771761cec8b3 to your computer and use it in GitHub Desktop.
C Program to Draw Khayam-Pascal Triangle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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