Thursday, May 21, 2020

Do-while loop in C++


  • Syntax :

       do 
       {
       // code block to be executed       }
       while (condition);

  • Program :

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