• 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

Understanding infinite loop with while loop

CS50 threads to aide as a supplementary resource › Forums › CS50’s Introduction to Computer Science by Harvard University on Edx › Week 1 › Understanding infinite loop with while loop

Tagged: infinite loop, loop, loops

  • This topic is empty.
Log In Register Lost Password
Viewing 1 post (of 1 total)
  • Author
    Posts
  • August 20, 2021 at 8:38 am #96
    admin
    Keymaster


      Copy Code
      Copied
      Use a different Browser

      
      
      #include <stdio.h>
      #include <cs50.h>
      int main(void)
      {
      int h;
      h = get_int("h ");
          while (h > 2)
          {
          printf ("ffff");
          }
      }
      

      As any integer greater than 2 entered, there is an infinite loop (ffff printed infinitely). Could anyone please explain why so.
       


      Reply


      https://cs50.stackexchange.com/questions/41832/understanding-infinite-loop-with-while-loop[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.