Skip to content

Instantly share code, notes, and snippets.

@yesidays
Created January 14, 2012 17:57
Show Gist options
  • Save yesidays/1612263 to your computer and use it in GitHub Desktop.
Save yesidays/1612263 to your computer and use it in GitHub Desktop.
code.jobs - Pyramid of asterisks - C
#include <iostream>
#include<stdio.h>
int main(){
int height;
printf("Enter the number of levels ");
scanf("%d",&height);
for (int rows=1; rows<=height; rows++){
for (int whites=1; whites<=height-rows; whites++){
printf(" ");
}
for (int columns=1; columns<=2*rows-1; columns++){
printf("*");
}
printf("\n");
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment