- 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