tdio.h>Рint main( )Р{Рint n; //500-1 之间的整数Рint sum = 0; //求和变量Рint count = 0; //满足条件的数的个数Рfor ( n=500; n>0; --n)Р{Рif ( n % 13 == 0 || n % 17 == 0 )Р{Рsum += n;Р++count;Рif ( count >= 10 ) //有 10 个满足条件的整数,提前结束循环Рbreak;Р}Р}Рprintf(“sum = %d\n”, sum );Рreturn 0;Р}Р【程序运行结果如下: 】Р第 7 章Р1. B Р2. 编写程序。功能:百马百担问题:有 100 匹马,驮 100 担货,大马驮三担,中马驮Р2 担,两匹小马驮一担,求大、中、小马各多少匹?Р【程序代码如下: 】Р#include <stdio.h>Рint main( )Р{Рint bigHorse, midHorse, littleHorse; //大、中、小马的数量Рfor ( bigHorse = 0; bigHorse <= 33; ++bigHorse )Рfor( midHorse = 0; midHorse <= 50; ++midHorse )Р{РlittleHorse = 100 – bigHorse – midHorse; //小马数量Рif ( littleHorse % 2 == 0 && (3*bigHorse + 2*midHorse + littleHorse / 2Р== 100 ) ) //小马数量是偶数,且三种马驮的货是 100 担Рprintf(“大马:%d, 中马:%d, 小马:%d\n”, bigHorse, midHorse,РlittleHorse );Р}Рreturn 0;Р}Р【程序运行结果如下: 】