展开全部
import java.util.Scanner;
import java.util.Random;
import java.util.Calendar;
public class P
{
public static void main(String[] args)
{
int a,num1,num2,total=10,right=0,wrong=0;
Scanner sc=new Scanner(System.in);
Random r=new Random(Calendar.getInstance().getTimeInMillis());
while(total>0)
{
num1=r.nextInt(101);
num2=r.nextInt(101);
System.out.print(""+num1+"+"+num2+"=");
a=Integer.parseInt(sc.nextLine());
if(a==num1+num2)
{
right++;
System.out.println("答题正确,很好");
}
else
{
wrong++;
System.out.println("答题错误,加油");
}
total--;
}
System.out.println("每题10分,共回答10题,对"+right+"题,错"+wrong+"题。得分:"+(right*10));
}
}
import java.util.Random;
import java.util.Calendar;
public class P
{
public static void main(String[] args)
{
int a,num1,num2,total=10,right=0,wrong=0;
Scanner sc=new Scanner(System.in);
Random r=new Random(Calendar.getInstance().getTimeInMillis());
while(total>0)
{
num1=r.nextInt(101);
num2=r.nextInt(101);
System.out.print(""+num1+"+"+num2+"=");
a=Integer.parseInt(sc.nextLine());
if(a==num1+num2)
{
right++;
System.out.println("答题正确,很好");
}
else
{
wrong++;
System.out.println("答题错误,加油");
}
total--;
}
System.out.println("每题10分,共回答10题,对"+right+"题,错"+wrong+"题。得分:"+(right*10));
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询