I
ishwar mehta
/* HEY FRND HELP ME TO FIGURE OUT WRONG WITH THIS PROGRAM */
#include<stdio.h>
int main()
{
int i,n,x;
x=1;
printf("PUT THE NO.");
scanf("%d",&n);
if(n==0)
printf("THE FACTORIAL VALUE IS %d\n",x);
else
{
for (i=1;i<=n;i++)
x=x*i;
}
printf(" the value is %d\n",x);
return 0;
}
hey frnd i wrote this program to calculate the factorial value for a
number,but in the output i got wrong value for n>16.
my output for various values is as:
PUT THE NO.17
the value is -288522240
PUT THE NO.37
the value is 0
and so on...
PLZ help me...to correct the error.. if any..
#include<stdio.h>
int main()
{
int i,n,x;
x=1;
printf("PUT THE NO.");
scanf("%d",&n);
if(n==0)
printf("THE FACTORIAL VALUE IS %d\n",x);
else
{
for (i=1;i<=n;i++)
x=x*i;
}
printf(" the value is %d\n",x);
return 0;
}
hey frnd i wrote this program to calculate the factorial value for a
number,but in the output i got wrong value for n>16.
my output for various values is as:
PUT THE NO.17
the value is -288522240
PUT THE NO.37
the value is 0
and so on...
PLZ help me...to correct the error.. if any..