I'm pretty new to C but so far I have been pretty OK when it comes to implementing programs. I have been working with this program for about a week now, and I'm just about finished with it. The program is suppose to allow the user to input a persons name and then his/her three test scores. This process is looped-which is shown in the sample output- until the user enters "CTRL-Z". I'm certain I have the gist of the program, it's just I'm running out of time and can't get it to work like the sample output.

The loops in this program have me baffled, and I just need someone to help point out my mistakes, so I can get it running smoothly.

-----------------------------------------------------
Code:
#include<stdio.h>


typedef struct {
char name[60];
float exam[3]; /* 3 exams*/
float avg;
} person_t;


int main()
{
person_t persons[50]; //declare structure variable array- up to 50 people
int i, count = 0; //intitializing counting variable
float avg, sum = 0, sum_v = 0;


while(1) // loop repeats until ctrl-Z is pressed
{
printf("\nEnter student name <Ctrl-Z to stop>: ");
scanf("%s",& persons[count].name[i]);


for (i = 0; i < 3; i++)
{
printf("Enter student's three exams: ");
scanf("%d", & persons[count].exam[i]); // Allows user to input the values for three values
sum = sum + persons[count].exam[i]; //summing up the test values
}
persons[count].avg = sum/3; //average of the values entered
printf("\n\nName\t\t\t\t\tExam 1\tExam 2\tExam 3\tAverage\n"); // Should be output in this format

printf("%s\t\t\t\t%f\t %f \t %f \t %.1f\n",persons[count].name, persons[count].exam[0],persons[count].exam[1], persons[count].exam[2], persons[count].avg);


sum_v = sum_v +(persons[count].avg);
count++;
}
avg = sum_v/count;
printf("\n\nThe class average is %.1f",avg);


system("pause");
return 0;
}

Expected Output:
--------------------------------------------------------------------------

C Program: Array Structures-question-jpg