Thursday, May 21, 2020

While loop in C++


  • Syntax :

      while (condition
       {
      // code block to be executed       }

  • Program :

#include <iostream>
using namespace std;
int main(){
    cout <<"\n----------------WHILE LOOP----------------\n";
    int i = 0;
  while (i < 5) {
    cout << i << "\n";
    i++;
  }
  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...