Skip to content
Merged
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
44 changes: 22 additions & 22 deletions _pages/2019/ap/problems/mario/less/mario.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ Implement a program that prints out a half-pyramid of a specified height, per th
----
$ [underline]#./mario#
Height: [underline]#5#
pass:[##]
pass:[###]
pass:[####]
pass:[#####]
pass:[######]
pass:[#]
pass:[##]
pass:[###]
pass:[####]
pass:[#####]

$ [underline]#./mario#
Height: [underline]#3#
pass:[##]
pass:[###]
pass:[####]
pass:[#]
pass:[##]
pass:[###]
----

include::../../../honesty.adoc[]
Expand All @@ -35,8 +35,8 @@ image:pyramid.png[Super Mario Brothers, width="50%"]

== Specification

* Write, in a file called `mario.c` in your `~/chapter1/mario/` directory, a program that recreates this half-pyramid using hashes (`#`) for blocks.
* To make things more interesting, first prompt the user for the half-pyramid's height, a non-negative integer no greater than `8`. (The height of the half-pyramid pictured above is indeed `8`.)
* Write, in a file called `mario.c` in your `~/chapter1/mario/` directory, a program that recreates a similar half-pyramid using hashes (`#`) for blocks.
* To make things more interesting, first prompt the user for the half-pyramid's height, a non-negative integer no greater than `8`.
* If the user fails to provide a non-negative integer no greater than `8`, you should re-prompt for the same again.
* Then, generate (with the help of `printf` and one or more loops) the desired half-pyramid.
* Take care to align the bottom-left corner of your half-pyramid with the left-hand edge of your terminal window.
Expand All @@ -53,10 +53,10 @@ Your program should behave per the example below. Assumed that the underlined te
----
$ [underline]#./mario#
Height: [underline]#4#
pass:[##]
pass:[###]
pass:[####]
pass:[#####]
pass:[#]
pass:[##]
pass:[###]
pass:[####]
----

[source,subs="macros,quotes"]
Expand All @@ -70,10 +70,10 @@ Height: [underline]#0#
$ [underline]#./mario#
Height: [underline]#-5#
Height: [underline]#4#
pass:[##]
pass:[###]
pass:[####]
pass:[#####]
pass:[#]
pass:[##]
pass:[###]
pass:[####]
----

[source,subs="macros,quotes"]
Expand All @@ -84,10 +84,10 @@ Height: [underline]#five#
Retry: [underline]#40#
Height: [underline]#24#
Height: [underline]#4#
pass:[##]
pass:[###]
pass:[####]
pass:[#####]
pass:[#]
pass:[##]
pass:[###]
pass:[####]
----

== Testing
Expand Down