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, 23.06.2019 15:30
Brian wants to conduct an online search with a certain phrase. he intends to use the words books that belong to the 1800s in his search. how should he use the word that in his search?
Answers: 1
question
Computers and Technology, 24.06.2019 07:00
Jean has kept the content of her website limited to what is important; she has also ensured that the text follows a particular style and color all throughout her website. which website features has jean kept in mind? jean has limited the content of her website to what is important; this ensures (clarity, simplicity, harmony and unity) of the content. she has also formatted the text in a particular style and color throughout her website, ensuring (balance, simplicity, consistency)
Answers: 2
question
Computers and Technology, 24.06.2019 16:30
Pressing the backspace key deletes the text to the of the insertion point. the left or the right?
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
Pseudocode pld #6, pg. 117 start// declarations// number numbertoguess// number myguess; numbertoguess = 92// while myguess ! = numbertoguess// output " guess an integer number between 1 and 100"// input myguess// if (myguess == numbertoguess)// output "you guessed the correct number"// else// output "the number you guessed was incorrect. try again! "// end if// end while// output " for playing the guessing game. have a great day! "// stop
Answers: 3
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
Mathematics, 09.10.2021 14:00
question
Mathematics, 09.10.2021 14:00
Questions on the website: 13722361