aboutsummaryrefslogtreecommitdiff
path: root/rush00/ex04/rush04.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rush00/ex04/rush04.rs')
-rw-r--r--rush00/ex04/rush04.rs52
1 files changed, 52 insertions, 0 deletions
diff --git a/rush00/ex04/rush04.rs b/rush00/ex04/rush04.rs
new file mode 100644
index 0000000..dfe2cb6
--- /dev/null
+++ b/rush00/ex04/rush04.rs
@@ -0,0 +1,52 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* rush04.rs :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/05/21 13:44:52 by charles #+# #+# */
+/* Updated: 2020/05/21 13:45:31 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+pub fn rush(x: i32, y: i32) {
+ if x == 0 || y == 0 {
+ return ;
+ }
+
+ if x >= 1 {
+ print!("A");
+ }
+ for _ in 1..x - 1 {
+ print!("B");
+ }
+ if x >= 2 {
+ print!("C");
+ }
+ print!("\n");
+
+ for _ in 1..y - 1 {
+ print!("B");
+ for _ in 1..x - 1 {
+ print!(" ");
+ }
+ if x >= 2 {
+ print!("B");
+ }
+ print!("\n");
+ }
+
+ if y > 1 {
+ if x >= 1 {
+ print!("C");
+ }
+ for _ in 1..x - 1 {
+ print!("B");
+ }
+ if x >= 2 {
+ print!("A");
+ }
+ print!("\n");
+ }
+}