找考题网-背景图
未分类题

有下列程序: main () { int i; for (i=1;i<=40; i++) { if (i++%5==0) if(++i%8==0) printf('%d',i); } printf ('/n'); } 执行后的输出结果是( )。
D.40

A.5
B.24
C.32

【参考答案】

C
解析:在for循环体中,首先判断自变量i能否被5整除,然后再自加两次,最后判断i能否被8整除。当for循环执行到第30次时, i的值为30能被5整除,然后i经过两次自加1运算,值变为32,能被8整除,故执行“pnntf('%d',i);'语句,即输出32。本题的答案为选项C)。
热门试题

未分类题The climate of Earth is changing. Climatologists are confident that over the past century, the global average surface temperature has increased by about half a degree Celsius. This warming is thought to be at least partly the result of human activities, such as the burning of fossil fuels and the clearing of forests for agriculturE.As the global population grows and national economies expand, the global average temperature is expected to continue increasing by an additional 1.0 to 3.5℃ by the year 2100.Climate change is one of the most important environmental issues facing humankinD.Understanding the potential impacts of climate change for natural ecosystems is essential if we are going to manage our environment to minimize the negative consequences of climate change and maximize the opportunities that it may offer. Because natural ecosystems are complex, nonlinear systems, it follows that their responses to climate change are likely to be complex. Climate change may affect natural ecosystems in a variety of ways. In the short term, climate change can alter the mix of plant species in land ecosystems such as grasslands. In the long term, climate change has the potential to dramatically alter the geographic distribution of major vegetation types--savannas, forests, and tundrA.Climate change can also potentially alter global ecosystem processes, including the cycling of carbon, nitrogen, phosphorus, and sulfur. Moreover, changes in these ecosystem processes can affect and be affected by changes in the plant species of the ecosystem and vegetation typE.All of the climate change-induced alterations of natural ecosystems affect the services that these ecosystems provide to humans.The global average surface temperature increase of half a degree Celsius observed over the past century has been in part due to differential changes in daily maximum and minimum temperatures, resulting in a narrowing of the diurnal temperature rangE.Decreases in the diurnal temperature range were first identified in the United States, where large-area trends showed that maximum temperatures have remained constant or increased only slightly, whereas minimum temperature have increased at a faster ratE.In this issue, Alward et al. report on the different sensitivities of rangeland plants to minimum temperatures increases.Which of the following is NOT mentioned as a reason for the global warming?A.The burning of fuels such as coal or oil.B.The clearing of forests.C.The cultivation of farmlanD.D.The negative consequences of human activities.

A.0
B.5℃
C.
D.
E.
Which
F.The
G.
B.The
H.
C.The
I.
D.The