C语言函数求1-k中最大10个能被13或17整除的正整数之和
#include <stdio.h> int fun(int k) { int m=0,mc=0, j, n; while (k >= 1 && mc < 10) { if (k%13 == 0 || k%17 == 0) { m=m+k; mc++; } k--; } return (mc >= 10) ? m : 0; } main ( ) { printf("%d\n", fun(500)); }
AI 优化版
原文地址:https://www.cveoy.top/t/topic/nVK1 著作权归作者所有。请勿转载和采集!