I've got a worksheet which asks me to ask the user to enter a beginning and ending value. Create a for loop using these numbers. Also ask the user to enter another number. The program will search for multiples of this value.
a. The total of all values in the range
b. How many multiples of the specified number occurred within the range
c. How many numbers are in the range
Here's what I have so far:
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
#include <conio.h>
int main()
{
int beginning;
int ending;
int counter = 1;
int counter2 = 0;
int counter3 = 0;
cout<<"Please enter a beginning and ending value"<<endl;
cin>>beginning;
cin>>ending;
for (int counter = 1; counter <= ending; counter >= beginning; counter++)
{
int value = 0;
int counter2;
cout<<"Please enter another value"<<endl;
cin>>value;
while (value <= ending; value >= beginning; counter2++)
{
int sum = counter + counter2;
cout<<"The total of all values in the range is: "<<endl;
}
if (counter <= beginning && counter >= ending)
{
int total = counter++;
}
if (counter % value = value)
{
while (counter3++)
{
cout<<"There are "<<counter3<<"multiples"<<endl;
}
}
}
getch();
}