while(types
[dif
] = argv
[1][dif
])
range
= getnum(argv
[1]) + 1;
printf("Range is too large.\n");
for(i
= 0; i
< range
; i
++) {
ans
= left
[i
] + right
[j
];
printf("%d + %d = ", left
[i
], right
[j
]);
printf("%d - %d = ", t
, right
[j
]);
ans
= left
[i
] * right
[j
];
printf("%d x %d = ", left
[i
], right
[j
]);
t
= left
[i
] * right
[j
] + random(right
[j
]);
printf("%d / %d = ", t
, right
[j
]);
if(line
[0]=='\n') goto loop1
;
if(range
>= MAX
) goto loop1
;
right
[range
++] = right
[j
];
while((*rs
= getchar()) == ' ');
while((*rs
= getchar()) != '\n')
while((c
= *s
++) >= '0' && c
<= '9') {
rand() /*uniform on 0 to 2**13-1*/
return(hmul(rand(), 8*range
));
if(temp
>017777) temp
= 040000 - temp
;
return(hmul(temp
,8*range
));
/* 'hmul' returns the upper 16 bits of the product, where the operands
are assumed to be 16-bit integers. It replaces an old PDP-11
assembler language subroutine. -- dks.
hmul(a
,b
) { return(a
*b
>> 16); }
printf("\n\nRights %d; Wrongs %d; Score %d%%\n", rights
, wrongs
,
(rights
* 100)/(rights
+ wrongs
));
printf("Total time %ld seconds; %.1f seconds per problem\n\n\n",
(etvec
- stvec
) / (rights
+ 0.));
if(rights
+ wrongs
== 0.) {