C++ 统计 1 到 n 之间 7 的倍数的数量
#include<bits/stdc++.h> using namespace std; int main(){ int n,a=0; cin>>n; for(int i=1;i<=n;i++){ if(i%7==0) a++; // 如果 i 是 7 的倍数,那么 a 就加 1 } cout<<a<<endl; // 输出 a return 0; }
原文地址: https://www.cveoy.top/t/topic/oiXE 著作权归作者所有。请勿转载和采集!