#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define SIZE 10
int add(int a,int b)
{
int c;
c= a+b;
return c;
}
main()
{
int add1;
int add2;
int counter=0;
int
a;
int result;
char answer;
int score;
int i=1;
int wrong1[11]={0,0,0,0,0,0,0,0,0,0,0};
int wrong2[11]={0,0,0,0,0,0,0,0,0,0,0};
int wrong[11]={0,0,0,0,0,0,0,0,0,0,0};
printf("\tA math test for the year one schoolchildren\n\n");
for(i;i<=SIZE;i++)
{
srand(time(NULL));
add1=rand()%20+1;
add2=rand()%20+1;
printf("\(%d\)\t\t\t%d+%d=",i,add1,add2);
scanf("%d",&a);
result=add(add1,add2);
if(a==result)
{
printf("You're right!\n");
counter++;
}
else
{
printf("You are wrong!Be careful!\n");
wrong1[i]=add1;
wrong2[i]=add2;
wrong[i]=result;
}
}
printf("\n\n\n");
for(i=1;i<=SIZE;i++)
{
if(wrong1[i]!=0)
{
printf("the set of the wrongs:");
printf("\(%d\)\t\t\t%d+%d=%d\n",i,wrong1[i],wrong2[i],wrong[i]);
}
else
;
}
printf("\n\n");
score=counter*10;
printf("The mark you got is %d\n\n",score);
}