HW3.12

本文介绍了一个简单的Java程序,该程序能够接收用户输入的一个整数,并判断这个数是否能被5和6同时整除、仅能被其中一个数整除还是完全不能被5或6整除。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

 1 import java.util.Scanner;
 2 
 3 public class Solution
 4 {
 5     public static void main(String[] args)
 6     {
 7         Scanner input = new Scanner(System.in);
 8 
 9         System.out.print("Enter a number: ");
10         int number = input.nextInt();
11 
12         input.close();
13 
14         if(number % 5 == 0 && number % 6 == 0)
15             System.out.println(number + " is divisible by both 5 and 6");
16         else if(number % 5 !=0 && number % 6 != 0)
17             System.out.println(number + " is not divisible by either 5 or 6");
18         else
19             System.out.println(number + " is divisible by 5 or 6, but not both");
20     }
21 }

 

转载于:https://www.cnblogs.com/wood-python/p/5763866.html

root@autodl-container-a53a4d9718-aacfe17b:~/autodl-tmp/detr/util# python plot_utils.py plot_utils.py::plot_logs info: logs param expects a list argument, converted to list[Path]. /root/autodl-tmp/detr/util/plot_utils.py:65: FutureWarning: DataFrame.interpolate with object dtype is deprecated and will raise in a future version. Call obj.infer_objects(copy=False) before interpolating instead. df.interpolate().ewm(com=ewm_col).mean().plot( TypeError: float() argument must be a string or a real number, not &#39;list&#39; The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/root/miniconda3/lib/python3.12/site-packages/pandas/core/window/rolling.py", line 371, in _prep_values values = ensure_float64(values) ^^^^^^^^^^^^^^^^^^^^^^ File "pandas/_libs/algos_common_helper.pxi", line 42, in pandas._libs.algos.ensure_float64 ValueError: setting an array element with a sequence. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/root/miniconda3/lib/python3.12/site-packages/pandas/core/window/rolling.py", line 489, in _apply_columnwise arr = self._prep_values(arr) ^^^^^^^^^^^^^^^^^^^^^^ File "/root/miniconda3/lib/python3.12/site-packages/pandas/core/window/rolling.py", line 373, in _prep_values raise TypeError(f"cannot handle this type -> {values.dtype}") from err TypeError: cannot handle this type -> object The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/root/autodl-tmp/detr/util/plot_utils.py", line 113, in <module> plot_logs(logs=Path(&#39;../outputs/detrcss03/&#39;),fields=(&#39;class_error&#39;, &#39;loss_bbox_unscaled&#39;, &#39;mAP&#39;), ewm_col=0, log_name=&#39;log.txt&#39;) File "/root/autodl-tmp/detr/util/plot_utils.py", line 65, in plot_logs df.interpolate().ewm(com=ewm_col).mean().plot( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/miniconda3/lib/python3.12/site-packages/pandas/core/window/ewm.py", line 565, in mean return self._apply(window_func, name="mean", numeric_only=numeric_only) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/miniconda3/lib/python3.12/site-packages/pandas/core/window/rolling.py", line 619, in _apply return self._apply_columnwise(homogeneous_func, name, numeric_only) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/miniconda3/lib/python3.12/site-packages/pandas/core/window/rolling.py", line 491, in _apply_columnwise raise DataError( pandas.errors.DataError: Cannot aggregate non-numeric type: object
06-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值