My for loop is not working fine in this code.
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
    int n;
    char name[100];
    int number;
    printf("Enter the value of n\n");
    scanf("%d", &n);
    printf("Enter %d values\n", n);
    for(int i=0; i<n; i++)
    {
        gets(name);
    }
}
Here I am taking names as string inputs n number of times (as per given value of n by the user), but it is only taking n-1 values as input and not n. For example, if n is taken as 3 then it is taking only 2 inputs.
 
    