1、#include stdio.hint main(void){int i, j;do{puts(please input the i value:);printf(i = ); scanf(%d, i);if (i % 2)puts(odd);elseputs(even);puts(please input the j value, 0: continue; o...

1、
#include <stdio.h> int main(void) { int i, j; do { puts("please input the i value:"); printf("i = "); scanf("%d", &i); if (i % 2) puts("odd"); else puts("even"); puts("please input the j value, 0: continue; other: quit."); printf("j = "); scanf("%d", &j); } while (j == 0); ## 当 while语句不为0时,会继续循环,即j等于0时会继续循环; 当while语句为0是,即j不等于0时会跳出循环。 return 0; }
沃梦达教程
本文标题为:c语言中循环控制语句(do语句)


基础教程推荐
猜你喜欢
- 如何C++使用模板特化功能 2023-03-05
- C++详细实现完整图书管理功能 2023-04-04
- C++使用easyX库实现三星环绕效果流程详解 2023-06-26
- 详解c# Emit技术 2023-03-25
- C语言基础全局变量与局部变量教程详解 2022-12-31
- C语言 structural body结构体详解用法 2022-12-06
- C利用语言实现数据结构之队列 2022-11-22
- 一文带你了解C++中的字符替换方法 2023-07-20
- C/C++编程中const的使用详解 2023-03-26
- C++中的atoi 函数简介 2023-01-05