Skip to main content

Posts

Showing posts with the label for loop

C++ While Loop Beginner Programming

Animated Gif of while loop statement C++ while loop While loop  know as loop making statement because it's depend on given condition  and increment value. while loop execute loop statements multiple times depends on condition and increment . while loop statement execute loop statements while condition is true. while condition becomes false it'll goes out of loop Syntax of while loop  is very simple //variable initialization while ( condition  ) { //loop statemets // increment } Example While #include <iostream>   using namespace std;  int main( ){        int x = 0; //initialization     while (  x < 4  ){ // condition          cout << " Value of x =  "<<  x << endl ;         x++ ;  //increment     }         cout<<"Out of Loop \n"<<end...

C++ for Loop Beginner Programming

C++ for loop for loop  know as loop making statement because it's depend on given condition  and increment value. for loop declare initialization condition and increment in the same line in for parameter. for loop execute loop statements multiple times depends on condition and increment . for loop statement execute loop statements while condition is true. while condition becomes false it'll goes out of loop Syntax of for loop  is very simple //variable initialization for (initialization ;  condition  ; increment ) { //loop statemets } Example for #include <iostream>   using namespace std;  int main( ){           //initialization , Condition , increment     for (int x = 0 ;  x < 4  ; x++){ // condition          cout << " Value of x =  "<<  x << endl ;         x++ ;...

C++ Do While Loop Beginner Programming Visual Studio

C++ do while loop do While loop  know as loop making statement because it's also depend on given condition  and increment value. do while loop execute loop statements multiple times depends on condition and increment . while loop statement execute loop statements at least one time without processing condition.  while condition is true it'll execute it again and again until condition become false. while condition becomes false it'll goes out of loop Syntax of do   while loop  is very simple //variable initialization do{ //loop statemets // increment }while ( condition  ); Example do While #include <iostream>   using namespace std;  int main( ){        int x = 10; //initialization   do {            cout << " Value of x =  "<<  x << endl ;       x++ ;  //increment   } while ...