Print following series 1 2 3 0 5 6 7 0 9 10 11 0.........so on

#include <iostream>
using namespace std;

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

cout<<endl;

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

{

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


i++;
}
}

Comments

Popular posts from this blog

Umbrella activities in Software Engineering

Operating System | Best Definition of Opetating System