Thursday, May 21, 2020

For loop in C++


  • Syntax :

     for (initialization; condition; increment(or)decrement
        {
      // code block to be executed
        }

  • Program :

#include <iostream>
using namespace std;
int main(){
    cout <<"\n----------------FOR LOOP----------------\n";
   for (int i = 0; i <= 10; i = i + 2) {
    cout << i << "\n";
  }
  return 0;
}




  • Output :



No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...