В выводе у меня сливаются строки в Си

Мой код, но в выводе в самом первом я уже получаю сливание строк: Author: Book2 ...

#include <stdio.h> 
#include <string.h> 
struct Book {    
   char title[100];  
   int volume;  
   int year;  
   char author[100]; 
   }; 
struct Magazine { 
    char title[100]; 
    int volume; 
    int month; 
    int year; 
    char editorialBoard[100]; 
   }; 
 
struct Newspaper {     char title[100]; 
    int volume; 
    int day; 
    int month; 
    int year; 
    char editor[100]; 
   }; 
 
struct Book books[10]; 
struct Magazine magazines[10]; 
struct Newspaper newspapers[10];  
int main(){ 
    int numBooks,numMagazine,numNewspapers,year; 
    printf("Enter the number of books: "); 
    scanf("%d",&numBooks); 
    printf("Enter number of journals: "); 
    scanf("%d",&numMagazine); 
    printf("Enter number of newspapers: "); 
    scanf("%d",&numNewspapers); 
 int i; 
 for(int i=0;i<numBooks;i++){  
 printf("Book %d\n",i+1); 
 printf("Title: "); 
 scanf("%s",&books[i].title); 
 printf("Volume: "); 
 scanf("%d",&books[i].volume); 
 printf("Year: "); 
 scanf("%d",&books[i].year); 
 printf("Author: "); 
 fgets(books[i].author,100,stdin); 
 } 
 int j; 
 
 for(int j=0;j<numMagazine;j++){ 
    printf("Journal %d\n",j+1); 
    printf("Title: "); 
    scanf("%s",&magazines[j].title); 
    printf("Volume: "); 
    scanf("%d",&magazines[j].volume); 
    printf("Month: "); 
    scanf("%d",&magazines[j].month); 
    printf("Year: "); 
    scanf("%d",&magazines[j].year); 
    printf("Editors: "); 
    fgets(magazines[j].editorialBoard,100,stdin); 
 } 
 int k; 
 
 for(int k=0;k<numNewspapers;k++){ 
    printf("Newspaper %d\n",k+1); 
    printf("Title: "); 
    scanf("%s",&newspapers[k].title); 
    printf("Volume: "); 
    scanf("%d",&newspapers[k].volume); 
    printf("Month: "); 
    scanf("%d",&newspapers[k].month); 
    printf("Year: "); 
    scanf("%d",&newspapers[k].year); 
    printf("Day: "); 
    scanf("%d",&newspapers[k].day); 
    printf("Editors: "); 
    fgets(newspapers[k].editor,100,stdin); 
 }    
 
 printf("\nEnter the year: "); 
 scanf("%d",&year); 
 
 
 int n; 
 for(n=0;n<numBooks;++n){ 
    if(books[i].year == year){ 
        printf("Book: %s, Author: %s\n",books[i].title,books[i].author); 
    } 
 }  
 
 int l; 
 for(l=0;l<numMagazine;++l){ 
    if(magazines[j].year == year){ 
        printf("Magazine: %s, Editors: %s\n",magazines[j].title,magazines[j].editorialBoard); 
    } 
 }      
 
 for(int m = 0; m<numNewspapers ; m++){ 
    if(newspapers[k].year == year){ 
            printf("Newpaper: %s , Editor: %s \n",newspapers[k].title ,newspapers[k].editor); 
    }   
  }       
 
 return 0;  
}

Ответы (0 шт):