SYNTAX OF FOR LOOP IN C++
for(initialisation; condition; increment/decrement){
code in c++ language;
}
SOURCE CODE
#include<iostream>
using namespace std;
int main(){
for(int i = 1; i<=9; i++){
cout<<"The value of i is : "<<i<<endl;
}
return 0;
}
// OUTPUT
// The value of i is : 1
// The value of i is : 2
// The value of i is : 3
// The value of i is : 4
// The value of i is : 5
// The value of i is : 6
// The value of i is : 7
// The value of i is : 8
// The value of i is : 9
Comments
Post a Comment