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>
usingnamespace 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;
}
}
#include <iostream>
usingnamespace 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++;
}
}