subject
Computers and Technology, 01.09.2019 14:30 anyar

Ihave to writea piece of code to calculate the factorial of somewhat large numbers so the long long type won't suffize, so using vector, i stumbled upon some issues during run time:
'#include
#include
using namespace std;
vector factorial(short n)
{
vector v, z;
do
{
short m = n%10;
v. push_back(m);
}while(n/=10);
short temp = 0;
int x;
//short m = 0;
while(n-1)
{
for(auto & w : v)
{
x = w*(n-1) + temp;
temp = x/10;
z. push_back(x%10);
}
}
return z;
}
int main()
{
short t;
cin > > t;
vector v;
short temp;
while(
{
cin > > temp;
v. push_back(temp);
}
vector tmp;
for(auto & w : v)
{
tmp = factorial(w);
for(auto i=tmp. end(); i! =tmp. begin();
cout < < *i;
cout < < endl;
}
return 0;
}
'

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:40
Match each feature of e-publishing as an advantage, a disadvantage, a threat, or an opportunity. (choices) increased collaboration digitalized out-of-print versions monopoly over digital formats requirement for a specialized digital device pairs advantage of e-publishing disadvantage of e- opportunity for e- threat to e-
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
Who needs to approve a change before it is initiated? (select two.) -change board -client or end user -ceo -personnel manager -project manager
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
Where can page numbers appear? check all that apply. in the header inside tables in the footer at the bottom of columns at the top of columns
Answers: 1
You know the right answer?
Ihave to writea piece of code to calculate the factorial of somewhat large numbers so the long long...
Questions
question
English, 24.11.2020 20:10
question
Mathematics, 24.11.2020 20:10
question
Mathematics, 24.11.2020 20:10
question
Mathematics, 24.11.2020 20:10