Noob here, need help with

Thanks Josue Molina






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
using std::cout;
using std::endl;
using std::cin;

int main()
{
		cout << "Please Enter Two Integers : " << endl;
		
		int integer1 ;
		int integer2 ;
		int product = 0;
		int product1 = 0;
		int one = 1;
		cin >> integer1 ;
		cin >> integer2 ;

		if (integer1 < integer2)		
			{
			while (integer1 < integer2)
			{
			

			int number1 = (product1 * integer2) ;
			number1 = (integer1 + 1);
			product1 = integer1 * (integer1 + one++);

			if (number1 == integer2)
			{
				int product2 = number1;
			}
			
			cout << "The Product For The Series of " << integer1 << " and " << integer2 << " Is: " << product2 << std::endl ;
					return 0;
			}
		}
		else if (integer2 < integer1)
		{
		
			

		}
		else if (integer1 = integer2)
		{
			product = integer1;
			cout << "The Series Product For " << integer1 << " and " << integer2 << " Is: " << product << std::endl ;
			return 0;
		}
		
}
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

int main()
{
    std::cout << "Numbers: ";
    int a, b;
    std::cin >> a >> b;

    if (a > b)
        std::swap(a, b);

    int c = 1;

    for (int i = a; i <= b; i++)
        c *= i;

    std::cout << "Result: " << c;

    return 0;
}
thank you so much the only question i have is which part of this code allows for 7 and 7 =7 (or any of the same choosen number to equal itself with out essentially squaring?)?
Last edited on
It's all, on line 14. Trace the code; it's not that long. :-)
Topic archived. No new replies allowed.