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
Post a Comment