这个程序有点问题 谁能帮忙改一下
运行时输入2或三会出现负数#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int FAQ (int num,int scrone);
int main (void)
{
int num;//题数
int cou,s=0,scrone;//得数,分数 ,单题分数
//主界面
printf ("***********欢迎使用 小学算术运算测试 程序**************\n");
printf ("程序说明:\n");
printf (" 用户输入要回答的题数后,系统将会随机产生相应数目的\n");
printf (" 题目用户依次回答题目,系统将根据回答的正确与否给分\n");
printf ("请输入要回答的题数:");
scanf ("%d",&num);
scrone=100/num;
s=FAQ(num,scrone);
printf ("您回答了%d道题,满分为100分,您得到了%d分\n",num,s*100/num) ;
printf ("请输入回车键退出程序");
getchar();
getchar();
}
int FAQ(int num,int scrone)//问答模块
{
int ope,n1,n2,ans; //运算符,数1,数2,答案
int cou,scr=0;//得数,分数
int i,j;//循环用控制数
time_t t;
srand((unsigned) time(&t));
for (i=0;i<num;i++)
{
ope=rand()%4;
switch (ope)
{
case 0: {
n1=rand()%100;
n2=rand()%100;
ans=n1+n2;
printf ("%d+%d=",n1,n2);
scanf ("%d",&cou);
printf("正确答案为:%d\n",ans);
if (ans==cou)
scr=scr+1;
continue;
}
case 1: {
while (n1<n2)
{
n1=rand()%100;
n2=rand()%100;
}
ans=n1-n2;
printf ("%d-%d=",n1,n2);
scanf ("%d",&cou);
printf("正确答案为:%d\n",ans);
if (ans==cou)
scr=scr+1;
continue;
}
case 2: {
n1=rand()%100;
n2=rand()%100;
ans=n1*n2;
printf ("%d*%d=",n1,n2);
scanf ("%d",&cou);
printf("正确答案为:%d\n",ans);
if (ans==cou)
scr=scr+1;
continue;
}
case 3: {
while (n2!=0&&n1>n2)
{
n1=rand()%100;
n2=rand()%100;
}
ans=n1/n2;
printf ("%d/%d=",n1,n2);
scanf ("%d",&cou);
printf("正确答案为:%d\n",ans);
if (ans==cou)
scr=scr+1;
continue;
}
}
}
return (scr);
}