为了账号安全,请及时绑定邮箱和手机立即绑定

小白求教各位大神,关于java,求余数

小白求教各位大神,关于java,求余数

POPMUISE 2019-04-19 15:15:00
分别输入两个数double a,b;     r = b - count * a ;       求count为几的时候,r=1.0;     例如,double a = 1.3;          double b = 3.9;      那么,count = 3import java.util.Scanner; public class Exg {     public static void main(String[] args) {         Scanner s = new Scanner(System.in);         System.out.println("Pleat enter the first number!");         double a = s.nextDouble();         Scanner w = new Scanner(System.in);         System.out.println("Pleat enter the second number (larger than the first number) !");         double b = w.nextDouble();         double count=1.0;         double r;         do {              r = b- count * a;             count ++;         }while(r==1.0);         System.out.println(count);     }    }结果大概的样子为:Pleat enter the first number! 2.3 Pleat enter the second number (larger than the first number) ! 36.9 2.0好忧伤啊, 不论添什么数,结果都是2.0
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 435 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号