problem with scanning part of an struct, using pointer and malloc
#include <stdio.h>
#include <stdlib.h>
struct evento{
    char nome [100];
    char local [100];
    int dia;
    int mos;
    int anos;
};
int main (){
    int i,n;
    i=0;
    scanf ("%d",&n);
    struct evento *agenda;
    agenda =(struct evento*) malloc(n*sizeof(struct evento));
    for (i=0;i<n;i++){
        fgets (agenda[i].nome,100,stdin);
        fgets (agenda[i].local,100,stdin);
        scanf ("%d",&agenda[i].dia);
        scanf ("%d",&agenda[i].mos);
        scanf ("%d",&agenda[i].anos);
    }
    printf ("happy day");
    free(agenda);
    return 0;
}
When I put the value of n and the two strings, the program will printf the quote and not let me put the value of neither dia, mos or anos.
so if I put something like 1 (value of n), name and event, the program will finish and printf the quote, instead of letting me put the other values. why???
