Why does my program close before taking the input for k and then displaying it.
I am writing a code for a menu based program so I need to take input from user after he has entered the information so I can have 1.Print names 2.Exit while doing this I realized my program didn't take the input and just skipped the part where it is supposed to take value of l from user. So trying to debug it I deleted stuff and came down to this simple program and realized it still wont work any idea why?
#include <stdio.h>
struct student
{
    char name[50];
    char lname[50];
    float marks;
} s[15];
int main ()
{
    int i, j,k;
    printf("Please enter the number of students:\n");
    scanf ("%d", &j);
    printf ("Please enter the information for students as asked.\n");
    for (i = 0; i < j; i++)
    {
        scanf ("%s %s %f\n", s[i].name, s[i].lname, &s[i].marks);
    }
    printf("Please enter a number\n");
    scanf ("%d", &k);
    printf("your number was %d", k);
    return 0; 
}
 
     
     
    