1.while循环语句基本结构? while condition: loop body 2.利用while语句写出猜大小的游戏: 设定一个理想数字比如:66,让用户输入数字,如果比66大,则显示猜测的结果大了:如果比66小,则显示猜测的结果小了;只有等于66,显示猜测结果正确,然后退出循环. while True: num = int(input(">>>")) if num < 66: print("小了") elif num > 6…
class While05{ public static void main(String[ ]args){ //练习1:使用while循环完成输出1------10中的每个数 /*int i =1; while(i<=10){ System.out.println(i); i++; }*/ } } class While06{ public static void main(String[ ]args){ //练习2:使用while循环完成输出所有的两位数 int i =10; while(i…
do while #include <stdio.h> #include <stdlib.h> int main() { int a = 1,b = 10; do { b -= a; a++; } while (b-- < 0); printf("%d\n",b); // 8 return 0; } 不管条件是否满足都执行一次. 模拟dos游戏. #include <stdio.h> #include <stdlib.h> int…