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. java的哈希遍历 hashmap

    Map<String,String> map = new HashMap<String, String>(); map.put("title"," ...

  2. linux 下查看网卡工作速率

    [root@hadoop058 ~]# mii-tool eth0: negotiated 100baseTx-FD, link ok 100M linux 下查看网卡工作速率 Ethtool是用于查 ...

  3. Join/remove server into/from windows domain PS script

    Join server into windows domain PS script $username = "ad-domain\admin" $Password = " ...

  4. ActiveMQ(3) ActiveMQ创建(simpleAuthenticationPlugin)安全认证

    控制端安全认证: ActiveMQ目录conf下jetty.xml: <bean id="securityLoginService" class="org.ecli ...

  5. 在Debian9安装node和npm

    这学期又快结束了,坐在每天面对的电脑面,本着整理资料.更换心情的目的,我重装了一下自己的debian.下面就将自己安装node的过程进行记录与分享. node的官网:https://nodejs.or ...

  6. React 获取 url 参数 —— this.props.match

    在 react 组件的  componentDidMount 方法中打印一下 this.props,在浏览器控制台中查看输出如下: 其中页面的 url 信息全都包含在 match 字段中,以地址 lo ...

  7. 【CF1023F】Mobile Phone Network(dsu,MST)

    题意: 保证原边以边权单调非减的顺序读入 思路:先把未知边加入,再加入原始边做MST,考虑从大到小,用数据结构维护,每一条原始边相当两个链赋值操作,每一条未知边相当于一个询问,答案即为询问之和 LCT ...

  8. linux下面which whereis find locate的使用

    我们经常在linux要查找某个文件,但不知道放在哪里了,可以使用下面的一些命令来搜索.这些是从网上找到的资料,因为有时很长时间不会用到,当要用的时候经常弄混了,所以放到这里方便使用. which    ...

  9. UVA 10471 Gift Exchanging

    题意:就5种盒子,给出每个盒子个数,盒子总数,每个人选择这个盒子的概率.求这个人选择哪个盒子取得第一个朋友的概率最大,最大多少 dp[N][sta]表示当前第N个人面临状态sta(选择盒子的状态可以用 ...

  10. malloc和new的区别 end

    3. c++中new的几种用法 c++中,new的用法很灵活,这里进行了简单的总结: 1. new() 分配这种类型的一个大小的内存空间,并以括号中的值来初始化这个变量; 2. new[] 分配这种类 ...