#include <iostream>
usingnamespace std;
void main()
{
int x = 0, y = 0, m = 0;
cout << "Hello, this program will find the multiples of x below y" << endl;
system("pause");
cout << "Please enter the value of x: " ;
cin >> x;
cout << "Please enter the value of y: " ;
cin >> m;
cout << "Now the computer will find all the multiples of x below y" << endl;
system("pause");
while(y <= m)
{
y += x;
cout << y << endl;
}
system("pause");
}
The only thing I doubt about my source code is that I don't get what you mean about multiples of x below y. So I just assume that if x = 10 and y = 2, then the results would be the y multiples of x which is 2 multiples of 10 as such: 10, 20.
#include <iostream>
#include<fstream>
#include <windows.h>
usingnamespace std;
int main()
{
ofstream output;
int x = 0, y = 0, m = 1;
cout << "Hello, this program will find the multiples of x below y" << endl;
cout << "Please enter the value of x: " ;
cin >> x;
cout << "Please enter the value of y: " ;
cin >> y;
cout << "Now the computer will find all the multiples of x below y" << endl;
system("pause");
output.open("1.doc");
while(m <= y)
{
output<< x * m << endl;
m++;
}
output.close();
cout<<"Saving results to '1.doc' in the current directory..."<<endl;
system("pause");
cout<<"SUCCESSFUL!";
}
my program finds the multiples of x below y, that means if you were to write x as 3 and y as 1000, my program will find the multiples of 3 until it reaches 1000