Showing posts with label Series of Integer which is divide by 3. Show all posts
Showing posts with label Series of Integer which is divide by 3. Show all posts

15.9.15

print all integer which are divisible by 3 using c++

/* Series of Integer which is divide by 3 */

#include<iostream>
#include<conio.h>
using namespace std;
int series(int start,int last)
{
    cout<<"The series which is divide by 3 is:"<<endl;
    for(int i=start;i<=last;i++)
    {
        if(i%3==0)
        {
            cout<<i<<"\t";
        }
    }
}
int main()
{
    int start,last;
    cout<<"Enter start value:"<<endl;
    cin>>start;
    cout<<"Enter Last value:"<<endl;
    cin>>last;
    series(start,last);
    getch();
    return 0;
}