Find out OUTPUT of the following program #include <iostream.h>int main(){for (int i=1; i<=10; i++){cout << ‘‘ i = ’’ << i << endl ;}return 0;}Output:
Find out OUTPUT of the following
#include <iostream.h>
int main()
{
for (int i=1; i<=10; i++)
{
cout << ‘‘ i = ’’ << i << endl ;
}
return 0;
}
Output:
The given CPP program Contains a for loop,
The for loop declare and initialize the variable i by 1.
This for loop will execute until the value of i becomes equal or greater than 10.
It increments the value of i by 1.
In the body of the for loop display the value of the variable named i using the cout statement.
The endl statement is used for the new line.
The standard namespace named std is defined the cout and endl statements. Include it in the program.
CPP program:
//including header files
#include <iostream>
//using standard namespace
using namespace std;
//main function
int main()
{
//for loop for the value of i from 1 to 10
for (int i = 1; i <= 10; i++)
{
//display the value of i
cout << "i = " << i << endl ;
}
return 0;
}
Step by step
Solved in 3 steps with 1 images