Created
August 7, 2018 20:38
-
-
Save peterooch/52fe6b497d42548cb4ec660f68fac8e0 to your computer and use it in GitHub Desktop.
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
#include <stdio.h> | |
#include <stdbool.h> | |
int main() | |
{ | |
int i, n, stars; | |
int spaces; | |
char c; | |
scanf_s("%d%c", &n, &c); | |
n *= 2; | |
for (stars = 0; stars < n; stars++) | |
{ | |
if (stars % 2 == 0) | |
continue; // see line 12 | |
spaces = (n - stars) / 2; | |
for (i = 0; i < spaces; i++) | |
printf(" "); //padding before stars | |
for (i = 0; i < stars; i++) | |
printf("*"); | |
printf("\n"); | |
} | |
getchar(); | |
getchar(); | |
return true; | |
} |
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
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int i, n, stars; | |
int spaces; | |
int isoneorzero = 0; | |
char c; | |
scanf_s("%d%c", &n, &c); | |
system("cls"); | |
n *= 2; | |
for (stars = 0; stars < n; stars++) | |
{ | |
if (stars % 2 == 0) | |
continue; // see line 12 | |
spaces = (n - stars) / 2; | |
for (i = 0; i < spaces; i++) | |
printf(" "); //padding before stars | |
for (i = 0; i < stars; i++) | |
{ | |
isoneorzero = !isoneorzero; | |
printf("%d", isoneorzero); | |
} | |
printf("\n"); | |
} | |
getchar(); | |
getchar(); | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment