Suppose in the calculation of area of the circle, we need to take 10 inputs for radius and calculate the area for each input, it is a very tiresome process to write 10 scanf/cin statements for each input and calculate the radius for each one. It is for this reason the loop statements are very useful in any programming language.
C and C++ provides the following loop statements:
- while-loop
- for-loop
- do-while-loop
No comments:
Post a Comment