Skip to content

Instantly share code, notes, and snippets.

@SohanChy
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SohanChy/2161158a9e2ee06a1eda to your computer and use it in GitHub Desktop.
Save SohanChy/2161158a9e2ee06a1eda to your computer and use it in GitHub Desktop.
Simple Upside Down Pyramid Star Printing in C
#include <stdio.h>
int main()
{
int input;
do {
printf("ODD input please: ");
scanf("%d",&input);
}
while (input%2==0);
int x;
for(x=input;x>0;x=x-2)
{
printf("\t\t\t");
int j=input-x;;
while(j>0)
{
printf(" ");
j=j-2;
}
int i;
for(i=x;i>0;i=i-1)
{
printf("*");
}
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment