Arithmetic Ultimate Edition

Source: Internet
Author: User
Tags button type

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.