Arithmetic Ultimate Edition Requirements:
1, the generated problems in the calculation process can not produce negative numbers, that is, the arithmetic expression if there is a e1-e2 subexpression, then the result is greater than or equal to 0;
2. If there is a sub-expression of form such as e1/e2 in the generated topic, then the result should be a true score.
3, the number of operators in each topic does not exceed 3, brackets do not make detailed requirements.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">NewDocument </title> <meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "> <meta name=" generator "content=" EditPlus "/> <meta name=" author "content=" "/> <meta Name= "keywords" content= ""/> <meta name= "description" content= ""/> function Getrandomnum (min,max) {var Range= Max-Min; var Rand=Math.random (); return(Min + math.round (Rand *Range)); } function Max_num (x, y) {var t; while(y) {T= x percenty; X=y; Y=T; } returnx; } function Fenshu (a,b,p) {if(p==1) { if(a>b) {returnA + "/" +b; }Else if(a<b) { returnA + "/" +C; }Else { return1; } }Else{var x=a/p; var y=b/p; if(y==1){ returnx; }Else{ returnx+ "/" +y; }}} function F_count (a,b,c,d) {var Arr= ["+","-","*","/"]; var n= Getrandomnum (0,3); Switch(Arr[n]) { Case"+": {var sum_x= (a*d) + (b*c); var sum_y=b*D; Max_x=max_num (sum_x,sum_y); Max_y=max_num (sum_x,sum_y); var N=Fenshu (sum_x,sum_y,max_x); returnA + "/" +b+ "+" +c+ "/" +d+ "=" +N; Break; } Case"-": {var sum_x= (a*d)-(b*c); while(sum_x<0) {var a= Getrandomnum (1,30); var b= Getrandomnum (1,30); var c= Getrandomnum (1,30); var d= Getrandomnum (1,30); var sum_x= (a*d)-(b*c); } var sum_y=b*D; Max_x=max_num (sum_x,sum_y); Max_y=max_num (sum_x,sum_y); var N=Fenshu (sum_x,sum_y,max_x); returnA + "/" +b+ "-" +c+ "/" +d+ "=" +N; Break; } Case"*": {var sum_x=a*C; var sum_y=b*D; Max_x=max_num (sum_x,sum_y); Max_y=max_num (sum_x,sum_y); var N=Fenshu (sum_x,sum_y,max_x); returnA + "/" +b+ "*" +c+ "/" +d+ "=" +N; Break; } Case"/": {var sum_x=a*D; var sum_y=b*C; Max_x=max_num (sum_x,sum_y); Max_y=max_num (sum_x,sum_y); var N=Fenshu (sum_x,sum_y,max_x); returnA + "/" +b+ "÷" +c+ "/" +d+ "=" +N; Break; }}} function count (A, b) {var Arr= ["+","-","*","/"]; var n= Getrandomnum (0,3); Switch(Arr[n]) { Case"+": {var sum=a+b; returnA + "+" +b+ "=" +sum; Break; } Case"-": {var sum=a-b; while(sum<0) {var a= Getrandomnum (1,30); var b= Getrandomnum (1,30); var sum=a-b; } returnA + "-" +b+ "=" +sum; Break; } Case"*": {var sum=a*b; returnA + "*" +b+ "=" +sum; Break; } Case"/": {var sum=a/b; while(a%b!==0) {var max_x=Max_num (A, b); var N=Fenshu (a,b,max_x); returnA + "÷" +b+ "=" +N; } returnA + "÷" +b+ "=" +sum; Break; }}} function Pl_f () {var son_a= Getrandomnum (1,30); var par_b= Getrandomnum (1,30); var Son_c= Getrandomnum (1,30); var par_d= Getrandomnum (1,30); var suma=F_count (son_a,par_b,son_c,par_d); returnSuma; } function Pl () {var a= Getrandomnum (1,30); var b= Getrandomnum (1,30); var sumb=Count (A, b); returnSumb; } function Play_all () { for(i = 1; I <=30; i++) {var a= Getrandomnum (0,1); document.getElementById ("Text"). innerhtml+= ("<br>" + "+i+" question: "); Switch(a) { Case0: Var A=Pl (); var STRs= A.split ("="); document.getElementById ("Text"). innerhtml+= (strs[0]+ "=" + "<br>"); document.getElementById ("Text2"). innerhtml+= ("<br>" + "+i+" Answer: "+strs[1]); Break; Case1: Var B=Pl_f (); var STRs= B.split ("="); document.getElementById ("Text"). innerhtml+= (strs[0]+ "=" + "<br>"); document.getElementById ("Text2"). innerhtml+= ("<br>" + "+i+" Answer: "+strs[1]); Break; } } } </script>Arithmetic Ultimate Edition