Chapter 5 : Functions & Pointers (Let us C)

#include <stdio.h>
main()
{
int a, f;
printf("enter any number=");
scanf("%d",&a);
f=fact(a);
printf("%d!=%d",a,f);
}
fact(int x)
{
int i,f=1;
for(i=x;i>=1;i--)
{
f=f*i;
}
}

Output:


enter any number=33
33!=-2147483648


Comments

Popular posts from this blog

According to a study, the approximate level of intelligence of a person can be calculated using the following formula: i = 2 + ( y + 0.5 x ) Write a program, which will produce a table of values of i, y and x, where y varies from 1 to 6, and, for each value of y, x varies from 5.5 to 12.5 in steps of 0.5.

Let Us C / Chapter 4 (The Case Control Structure)