Monday, 16 June 2014

C++ program to print first n positive integers that are divisible by x



Here is a C++ program to print first n positive integers that are divisible by x


 SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
int main()
{
    int n,y;
    cout<<"Enter the value of n and y ";
    cin>>n>>y;
    for(int i=1;i<=n;i++)
        cout<<y*i<<" ";
    return 0;
}

Any questions regarding to program please write in comments.

No comments:

Post a Comment