求组各位大佬们
编写一个程序,统计7~91中有多少个能被三整除的奇数,输出统计结果。这个程序怎么才可以表示奇数?因为被三整除的有奇有偶啊啊啊
unsigned foo( unsigned from, unsigned to ) { return (to-3)/6 >= (from+5-3)/6 ? (to-3)/6-(from+5-3)/6+1 : 0; }
unsigned count = 0; for( unsigned i=7; i<=91; ++i ) { count += (i%3==0 && i%2==1); }
#include<stdio.h> int main() { int n,i; int sum=0; //scanf("%d",&n); for(i=7;i<=91;i++){ if(i%3==0&&i%2!=0){ printf("%d\n",i); sum+=1; } } printf("%d个能被三整除的奇数\n",sum); }