When I run it, it does not copy the answer. Any help? please.
---------------------------------------------------------------------------------
#include <iostream>
using namespace std;
int main()
{
int x;
cout<<"x: ";
cin>>x;
int i=2;
int z=1;
int s=1;
int p=1;
for (i=2;i<=64;i+2)
{
s=s*(x-i);
}
for (z=1;z<=63;z+2)
{
p=p*(x-z);
}
cout<<"el resultado es "<<s/p<<endl;
return 0;
}
Last edited on
Does it not copy the answer, or does it give the wrong answer?
s is an int.
p is an int.
int/int gives an int.
Here is an example: 3/2 = 1
Here is another example: 5 / 6 = 0
If you need a better answer than that, don't divide int. Divide double.
Now I used 'double' but it does not show the answer.
Your for loops never finish. The first one will finish when i>64, but i never changes.
Last edited on
It does show anything. I just copy "x:_" but after that, it does not do anything.
i + 2
does not change the i. Perhaps i += 2