63 066
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #10770 in C++ for Sanchit Agarwal

Question #10770
#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int numArr[3000]; // Approximately , size of array depends on size of factorial.
int total,rem=0,count; //rem use to save remainder of division(Carry Number).
register int i;
for(i=0;i<3000;i++)
numArr[i]=0; //set all array on NULL.

i=2999; //start from end of array.
numArr[2999]=1;

for(count=2;count<=1000;count++)
{
while(i>0)
{
total=numArr[i]*count+rem;
rem=0;
if(total>9)
{
numArr[i]=total%10;
rem=total/10;
}
else
numArr[i]=total;
i--;
}
rem=0;
total=0;
i=2999;
}

for(i=0;i<3000;i++) // Display array's cell to show factorial 1000
{
if(numArr[i]!=0 | count==1)
{
cout<<numArr[i];
count=1;
}
}

getch();
}

PLEASE EXPLAIN THIS PROGRAM GIVING AN EXAMPLE AND VALUES OF VARIABLE AT EACH STEP.
Expert's answer
Unfortunately, your question requires a lot of work and cannot be done for free.
Submit it with all requirements as an assignment to our control panel and we&#039;ll assist you.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions