Pages

C++ Programming Tutorials - 7 (Loops)

tut10.cpp =

// This tut contains For,While and do while Loop 
#include<iostream>
using namespace std;
 int main(){
     //*****************For Loop*************************
     for (int i = 1i < 6i++)
     {
         cout<<i<<endl;
         cout<<endl;
         cout<<endl;
         
     }

    
     cout<<"************************************************************************************************************************"<<endl;
     cout<<"************************************************************************************************************************"<<endl;
  
         
         
     //****************While Loop************************
     int j=1;
     while (j<=10)
     {
         cout<<j<<endl;
         j++;
         cout<<endl;
         cout<<endl;
         
     }

      cout<<"***********************************************************************************************************************"<<endl;
      cout<<"***********************************************************************************************************************"<<endl;
 
     
     //***************do while****************************
     int k=1;
     do
     {
         cout<<k<<endl;
         k++;
         cout<<endl;
         cout<<endl;
     } while (k<=20);

     return 0;
     
 }

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Top 10 Python Packages Every Developer Should Learn

Top 10 Python Packages Every Developer Should Learn There are more than  200,000 Python packages  in the world (and that’s just counting tho...