当前位置:网站首页>C language do while loop classic Level 2 questions
C language do while loop classic Level 2 questions
2022-07-06 14:48:00 【Drunk salted fish peddler】
A classic second level problem , The error rate is relatively high :
ask : At the end of the program b The value of is :
int a = 1,b = 10;
do
{
b -= a;
a++;
}while(b-- <0)
A. 9
B. -2
C.-1
D. 8
First do while No matter the condition is 0 Still for 1 Will cycle at least once , And this question is b > 0, So the condition is zero ( The condition is false ), So only cycle once , Go through the cycle b The value is 9,but, After the cycle, there is another b--,b Self reduction 1 No implementation ,9 Self subtraction 1 obtain 8.
边栏推荐
- servlet中 servlet context与 session与 request三个对象的常用方法和存放数据的作用域。
- Library management system
- 函数:用牛顿迭代法求方程的根
- The salary of testers is polarized. How to become an automated test with a monthly salary of 20K?
- C language learning summary (I) (under update)
- 【指针】删除字符串s中的所有空格
- 内网渗透之内网信息收集(三)
- Circular queue (C language)
- Résumé des points de connaissance et des réponses aux exercices après la classe du chapitre 7 de Jia junping dans la huitième édition des statistiques
- 《统计学》第八版贾俊平第二章课后习题及答案总结
猜你喜欢
Statistics 8th Edition Jia Junping Chapter XIII Summary of knowledge points of time series analysis and prediction and answers to exercises after class
《统计学》第八版贾俊平第十一章一元线性回归知识点总结及课后习题答案
Get started with Matplotlib drawing
The salary of testers is polarized. How to become an automated test with a monthly salary of 20K?
Statistics 8th Edition Jia Junping Chapter 14 summary of index knowledge points and answers to exercises after class
数字电路基础(五)算术运算电路
SystemVerilog discusses loop loop structure and built-in loop variable I
Login the system in the background, connect the database with JDBC, and do small case exercises
Transplant hummingbird e203 core to Da Vinci pro35t [Jichuang xinlai risc-v Cup] (I)
Summary of thread implementation
随机推荐
Realize applet payment function with applet cloud development (including source code)
《统计学》第八版贾俊平第四章总结及课后习题答案
Numpy Quick Start Guide
Zhejiang University Edition "C language programming experiment and exercise guide (3rd Edition)" topic set
我的第一篇博客
MySQL learning notes (stage 1)
Chain team implementation (C language)
Functions: Finding Roots of equations
《统计学》第八版贾俊平第十三章时间序列分析和预测知识点总结及课后习题答案
c语言学习总结(上)(更新中)
Numpy快速上手指南
[pointer] delete all spaces in the string s
The four connection methods of JDBC are directly coded
【指针】查找最大的字符串
Captcha killer verification code identification plug-in
Binary search tree concept
【指针】求字符串的长度
Transplant hummingbird e203 core to Da Vinci pro35t [Jichuang xinlai risc-v Cup] (I)
数据库多表链接的查询方式
How to test whether an object is a proxy- How to test if an object is a Proxy?