• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
June 30, 2022 |45.7K Views
Loops in C++ - Part 1 (Entry Controlled Loop)
  Share  2 Likes
Description
Discussion

In programming, sometimes there is a need to perform some operation more than once or (say) n number of times. Loops come into use when we need to repeatedly execute a block of statements.

For example: Suppose we want to print “Hello World” 10 times. This can be done in two ways as shown below: 


Manually we have to write the print() for C and cout for the C++ statement 10 times. Let’s say you have to write it 20 times (it would surely take more time to write 20 statements) now imagine you have to write it 100 times, it would be really hectic to re-write the same statement again and again. So, here loops have their role.

Loops in C++ - Part 1 (Entry Controlled Loop) : https://www.geeksforgeeks.org/loops-in-c-and-cpp/

Read More