• Skip to main content
  • Skip to footer

CS50's Introduction to Computer Science on Edx: Supplementary resource

CS50 threads to aide as a supplementary resource

Incremental hashes per row

CS50 threads to aide as a supplementary resource › Forums › CS50’s Introduction to Computer Science by Harvard University on Edx › Week 1 › Incremental hashes per row

  • This topic is empty.
Log In Register Lost Password
Viewing 1 post (of 1 total)
  • Author
    Posts
  • August 13, 2022 at 6:35 am #401
    admin
    Keymaster

      #include <cs50.h>
      #include <stdio.h>

      int main(void)
      {
      int t = get_int(“no. of bricks “);
      for (int i=0; i<t; i++)
      {
      printf(“#\n”);
      }
      }

      Seeking hints/help regarding formulating a suitable loop that will help print 1 hash in the first line, 2 hashes in the second line, 3 hashes in the third line and so on.

      Is there a way to multiply the output with printf command.

      On first row, 1x#.

      Second row, 2x#

      Third row, 3x#.

      While printf(“#\n”) taking care of printing 1 hash and moving to next line, is there a way to leverage the printf command with loop to print # twice for second row, and so on?

       

       


      Reply


      https://edstem.org/us/courses/176/discussion/1676837/[learn_press_profile]

    • Author
      Posts
    Log In Register Lost Password
    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.
    Log In

    Log in / Register

    Initiative by Digital Splendid OPC Pvt. Ltd.