Given an integer n, write a function that returns count of trailing zeroes in n!. Examples: Input: n = 5 Output: 1 Factorial of 5 is 20 which has one trailing 0. Input: n = 20 Output: 4 Factorial of 20 is 2432902008176640000 which has 4 trailing zeroes. Input: n = 100 Output: 24
void insert(struct node **s, void *data,unsigned int n)
ReplyDelete{
struct node *temp,*r;
int i;
if(*s == NULL)
{
temp = malloc(sizeof(struct node));
temp->data = malloc(n);
for (i = 0; i < n; i++)
*(char *)(temp->data + i) = *(char *)(data + i);
temp->link = NULL;
*s = temp;
}
else
{
temp =*s;
while(temp->link != NULL)
temp = temp->link;
r = malloc(sizeof(struct node));
r->data = malloc(sizeof(n));
for (i = 0; i < n; i++)
*(char *)(r->data + i) = *(char *)(data + i);
r->link = NULL;
temp->link = r;
}
}
In order to display the value You need to send the type of data it is storing as a parameter.