I have made a program that uses struct where a user can input a grade,average, and their name. I am trying to make it so their can be three students each with a grade average and name but I can not figure out how to make a loop so it will go through all three without stopping at student one adding numbers for everything else. Any help would be greatly appreciated.

#include "stdafx.h"
struct classes
{
	int num;
	char name[10];
	float avg;

};

int main()
{
	

struct classes student1, student2, student3;


printf("Please enter a grade for student 1\n");
scanf("%d", &student1.num);

printf("please input a average for student 1\n");
scanf("%f", &student1.avg);

printf("please enter students 1's name name\n");
scanf("%d", &student1.name);

printf("the grade for student one is %d\n",student1.num );
printf("the average for student one is %.2f\n",student1.avg );
printf("student ones name is %d\n",student1.name );


printf("Please enter a grade for student 2\n");
scanf("%d", &student2.num);

printf("please input a average for student 2\n");
scanf("%f", &student2.avg);

printf("please enter student 2's name\n");
scanf("%d", &student2.name);


printf("Please enter a grade for student 3\n");
scanf("%d", &student3.num);

printf("please input an average for student 3\n");
scanf("%f", &student3.avg);

printf("please enter student 3's name\n");
scanf("%d", &student3.name);


printf("the grade for student two is %d\n",student2.num );
printf("the average for student two is %.2f\n",student2.avg );
printf("student twos name is %d\n",student2.name );

printf("the grade for student three is %d\n",student3.num );
printf("the average for student three is %.2f\n",student3.avg );
printf("student threes name is %d\n",student3.name );
	

return 0;
}
This question has already been answered. Start a new discussion instead.