wHILE LOOP

Hi Guys, Can you teach me on how to do a Program that has a while loop and its about Factorial. Like number 1-10, then, if its 1=1x1 2=1x2 3=1x2x3 and so on and forth. Thanks in Advance guys!
what are you looking for, a program that reads out "1 2 3 4 5 6 7 8 9 10" or one what does multiplication for you, or just reads out a certain amount of factors.
this program allows you to pick a number to count up too and prints out all the numbers leading up to it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>

using namespace std;

int main()
{
	int x;
	int y;
	y = 1;
	
	cout << "Input number you would like to cout to: ";
	cin >> x;

	while (y != x)
	{
		y++;
		cout << y << endl;
	}
}
or this.. the program takes the number you input and multiply it by 1-10 and out puts the equation and the answer. still not quite sure what you want.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>

using namespace std;

int main()
{
	int x; // number picked by use to find the factors of
	int y; // number dividing by
	int n;
	y = 1;
	n = 1;
	
	cout << "What number would you like the factors of: ";
	cin >> x;
	while (y != 10)
	{
		cout << x;
		cout << "*";
		cout << y;
		cout << "= ";
		cout << x * y << endl;
		y++;
	}
}
Its like this for example is chose number 5, then itll print out 1x2x3x4x5 you get what I meann? Haha Thannkss
And also its Answer :)
can u post exactly what you would like the read out to look like.
Topic archived. No new replies allowed.