English

Write a for loop that displays the number from 21 to 30.

Advertisements

Question

Write a for loop that displays the number from 21 to 30.

Code Writing
Advertisements

Solution

# include
using namespace std;
int main()
{

for (int = 21; i < 31; i++)
cout << “value of i:” << i << endl;
return 0;
}
Output:
Value of i: 21
Value of i: 22
Value of i: 23
Value of i: 24
Value of i: 25
Value of i: 26
Value of i: 27
Value of i: 28
Value of i: 29
Value of i: 30

shaalaa.com
Iteration Statements
  Is there an error in this question or solution?
Chapter 10: Flow of Control - Evaluation - Section - B [Page 178]
Advertisements
Share
Notifications



      Forgot password?
Use app×