Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Mario Pyramids #175

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions C/Mario Pyramids
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include <cs50.h>
#include <stdio.h>

//cs50 Mario Pyramids
int main(void)
{
//get size
int j;
do{
printf("Enter a digit 1-8:");
scanf("%i",&j);
}
while(j>8 || j<1);
//print mario

for (int i=0;i<j;i++)
{
//print left space

for (int k=i-1;k<j;k++)
{
printf(" ");
}
//print left hash

for (int l=0;l<i+1;l++)
{
printf("#");
}
//print middle space

printf(" ");

//print right hash

for (int m=0;m<i+1;m++)
{
printf("#");
}

printf("\n");

}
}