Tagged: 

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #392
    admin
    Keymaster

      cs50 mario problem

      cs50 mario problem


      Reply


      #include <cs50.h>
      #include <stdio.h>
      int main(void)
      {
          for (int j=0; j<5; j++)
          {
          for (int i=0; i<5; i++)
          {
          printf(“#”);
          }
          printf(“\n”);
          }
      }

      Mario Problem

      Removing hardcoding to 5
      Instead of predetermined 5 bricks, why not ask user to enter no. of bricks.
      #include <cs50.h>
      #include <stdio.h>
      int main(void)
      {
          int t = get_int(“no. of bricks “);
          for (int j=0; j<t; j++)
          {
          for (int i=0; i<t; i++)
          {
          printf(“#”);
          }
          printf(“\n”);
          }
      }

      Mario cs50

      [learn_press_profile]

    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.
    Scroll to Top