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语句)


基础教程推荐
猜你喜欢
- centos 7 vscode cmake 编译c++工程 2023-09-17
- 带你深度走入C语言取整以及4种函数 2022-09-17
- C语言编程C++旋转字符操作串示例详解 2022-11-20
- C++实战之二进制数据处理与封装 2023-05-29
- C语言 详解字符串基础 2023-03-27
- C语言实现宾馆管理系统课程设计 2023-03-13
- C++实现ETW进行进程变动监控详解 2023-05-15
- 全面了解C语言 static 关键字 2023-03-26
- [C语言]二叉搜索树 2023-09-07
- [c语言-函数]不定量参数 2023-09-08