diff --git "a/33 \351\237\251\347\205\234\350\276\211/20230510.md" "b/33 \351\237\251\347\205\234\350\276\211/20230510.md" new file mode 100644 index 0000000000000000000000000000000000000000..5baef8a5705ce11fc4c3317ea21aa5771fdac7b6 --- /dev/null +++ "b/33 \351\237\251\347\205\234\350\276\211/20230510.md" @@ -0,0 +1,36 @@ +```java +import java.util.Scanner; + +public class Homework { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + System.out.println("请输入两个数字相加"); + while (true) { + try { + System.out.println("请输入第一个数字"); + double a=sc.nextDouble(); + if (a>=0){System.out.println("请输入第二个数字"); + double b=sc.nextDouble(); + if (b>=0){ + double c=a+b; + System.out.println("两个数的和为:"+c); + break; + } + } + + + + } catch (Exception e) { + System.out.println("你输入的内容有误"); + sc.next(); + + } + } + } + + + +} + +``` +