To print following series 1 2 3 0 5 6 7 0......upper limit

#include <iostream>
using namespace std;

void main ()
{
       int upperlimit;
       cout<<"Please enter the upperlimit ";
       cin>>upperlimit;

       int i=1;
       while (i<=upperlimit)

       {
            
             if(i%4==0) // if any multiple of 4 is printed then it print 0
                    cout<<"0"<<endl;
             else
                    cout<<i<<endl;


       i++;
       }

}

Comments

Popular posts from this blog

Umbrella activities in Software Engineering

Operating System | Best Definition of Opetating System