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.

#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'll assist you.

Submit it with all requirements as an assignment to our control panel and we'll assist you.

## Comments

## Leave a comment