Created
July 27, 2016 12:26
-
-
Save anonymous/55da24038d5028955127fd93d5f68cfd 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 <cs50.h> | |
#include <stdio.h> | |
int main() | |
{ | |
printf("Please input a non-negative integer up to 23\n"); | |
int h = GetInt(); | |
if (23<h || h<0) | |
{ | |
do | |
{ | |
printf("Retry:\n"); | |
h= GetInt (); | |
} while (23<h || h<0); | |
} | |
if (24>h && h>-1) | |
{ | |
int x=0; | |
int t=2; | |
int s=22; | |
while (x<h) | |
{ | |
int a = 0; | |
int b = 0; | |
while (a<s) | |
{ | |
printf(" "); | |
a++; | |
} | |
while (b<t) | |
{ | |
printf("#"); | |
b++; | |
} | |
printf("\n"); | |
x++; | |
t++; | |
s--; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment