import java.util.Scanner;
public class SubtractionQuiz {
public static void main(String[] args){
int number1=(int)(Math.random()*100);
int number2=(int)(Math.random()*100);
System.out.println("What is " + number1 + "+" + number2 + "? ");
Scanner input=new Scanner(System.in);
int answer=input.nextInt();
if(answer==number1+number2){
System.out.println("You are correct!");
}
else{
System.out.println("You answer is wrong.");
System.out.println(number1 + "+" + number2 + " should be " + (number1+number2));
}
}
}

Exercise03_10的更多相关文章

随机推荐

  1. VC++使用CImage PNG转BMP图片透明背景处理

    PNG格式的图片是支持透明通道的,BMP格式的图片是没有透明通道的,所以当PNG格式的图片转换为BMP格式时,对于PNG图片的透明背景就需要进行特别的处理. VC++中的HBITMAP是支持透明色的, ...

  2. Patch Windows with SSM on AWS

    ec2ssmupdate https://docs.amazonaws.cn/systems-manager/latest/userguide/systems-manager-patch.htmlht ...

  3. Sed basic and practice

    定义:Sed 是针对数据流的非交谈式编辑器,它在命令行下输入编辑命令并指定文件,然后可以在屏幕上看到编辑命令的输出结果. 好处:Sed 在缓冲区内默认逐行处理数据,所以源文件不会被更改和破坏. 格式: ...

  4. C++ Review

    #include "iostream" #include "iomanip" #include "cstdio" using namespa ...

  5. BZOJ 2095: [Poi2010]Bridges

    2095: [Poi2010]Bridges Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 869  Solved: 299[Submit][Stat ...

  6. centos 下构建lamp环境

    构建准备: 1.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp - ...

  7. HDU 1162 Eddy's picture (最小生成树 普里姆 )

    题目链接 Problem Description Eddy begins to like painting pictures recently ,he is sure of himself to be ...

  8. bzoj 1083 最小生成树

    裸的最小生成树. /************************************************************** Problem: User: BLADEVIL Lan ...

  9. 生成器版本的文件MD5校验

    生成器是一个可迭代的对象,可以对可迭代的对象进行便利,比如字符串.列表等,都是可迭代对象   def f(n): for i in range(n): yield i   特点: 1.当调用这个函数的 ...

  10. Django-csrf跨站请求伪造

    方式一: 下列代码插入ajax提交之$.ajaxSetup({ data: {csrfmiddlewaretoken: '{{ csrf_token }}' }, }); 注意:该代码中包含模板渲染语 ...