#include <stdio.h>#include<stdlib.h>#include<time.h>#defineN gMain () {intA,b,k,i,n, C,d,e,f,g; Do{printf ("\ n Please enter the number of questions:"); scanf ("%d",&g); printf ("\ n Please enter a number type (1. Integer 2. True score)-1 is the exit program:"); scanf ("%d",&N); Switch(n) { Case 1: { for(i=0; i<n;i++) {a=rand ()% -+1; b=rand ()% -+1; K=rand ()%4+1; printf ("%d", a); Switch(k) { Case 1:p rintf ("+"); Break; Case 2:p rintf ("-"); Break; Case 3:p rintf ("*"); Break; Case 4:p rintf ("/"); Break; } printf ("%d=\t\t", B); } Break; } Break; Case 2: { for(i=0; i<n;i++) {e=rand ()% -+1; F=rand ()% -+1; K=rand ()%4+1; if(e>=f) printf ("%d/%d", f,e); Elseprintf ("%d/%d", e,f); Switch(k) { Case 1:p rintf ("+"); Break; Case 2:p rintf ("-"); Break; Case 3:p rintf ("*"); Break; Case 4:p rintf ("/"); Break; } C=rand ()% -+1; D=rand ()% -+1; if(c>=d) printf ("%d/%d=\t\t", D,c); Elseprintf ("%d/%d=\t\t", c,d); } Break; } Break; } } while(n!=-1);}
Arithmetic 2.0