# Define destdio. h
# Define demath. h
# Includewindows. h
Int right = 0;
Int wrong = 0;
Void add ()
{
Int A, B, C;
A = rand () % 100;
B = rand () % 100;
Printf ("Please answer: \ n \ t % d + % d =", a, B );
Scanf ("% d", C );
If (a + B = C)
{
Printf ("correct answer! \ N ");
Right ++;
}
Else
{
Printf ("Answer error! \ N ");
Wrong ++;
}
}
Void Minu ()
{
Int A, B, C;
A = rand () % 100;
B = rand () % 100;
Printf ("Please answer: \ n \ t % d-% d =", a, B );
Scanf ("% d", C );
If (a-B = C)
{
Printf ("correct answer! \ N ");
Right ++;
}
Else
{
Printf ("Answer error! \ N ");
Wrong ++;
}
}
Void MUL ()
{
Int A, B, C;
A = rand () % 100;
B = rand () % 100;
Printf ("Please answer: \ n \ t % d * % d =", a, B );
Scanf ("% d", C );
If (A * B = C)
{
Printf ("correct answer! \ N ");
Right ++;
}
Else
{
Printf ("Answer error! \ N ");
Wrong ++;
}
}
Void di ()
{
Int A, B, C;
A = rand () % 100;
B = rand () % 100;
Printf ("Please answer: \ n \ t % d/% d =", a, B );
Scanf ("% d", C );
If (A/B = C)
{
Printf ("correct answer! \ N ");
Right ++;
}
Else
{
Printf ("Answer error! \ N ");
Wrong ++;
}
}
Void main ()
{
Int choise;
Int con = 0;
Printf ("\ n \ t welcome to elementary school simple four arithmetic \ n ");
While (1)
{
Printf ("select \ n ");
Printf ("\ t addition operation (enter 1) \ n ");
Printf ("\ t subtraction operation (enter 2) \ n ");
Printf ("\ t multiplication (enter 3) \ n ");
Printf ("\ t Division (enter 4) \ n ");
Printf ("\ t exit the operation (enter 5) \ n ");
If (con = 0)
Scanf ("% d", choise );
Switch (choise)
{
Case 1:
Add ();
Break;
Case 2:
Minu ();
Break;
Case 3:
Mul ();
Break;
Case 4:
Di ();
Break;
Case 5:
Return;
}
Printf ("\ n \ t continue operation? (Enter 1) \ n ");
Printf ("\ n \ t reselect? (Enter 2) \ n ");
Printf ("\ n \ t exit the operation? (Enter 3) \ n ");
Scanf ("% d", con );
If (con = 1)
Con = 1;
Else if (con = 2)
Con = 0;
Else if (con = 3)
Break;
Else
Printf ("Sorry !, The command you entered is incorrect! Enter again! \ N ");
}
Printf ("You have completed % d question \ n correct % d question \ n error % d question \ n", right + wrong, right, wrong );
}
Program for arithmetic operations