fork download
  1. /*3の倍数*/
  2. //nagaoka daigo
  3. #include <stdio.h>
  4. int main(void) {
  5. int s,n,x;
  6. s=0;n=0;x=0;
  7. do{
  8. n+=1;
  9. if(n%3==0){
  10. x+=1;
  11. s+=n;
  12. }
  13. }while(n<100);
  14. printf("3の倍数の個数=%d\n",x);
  15. printf("3の倍数の合計=%d\n",s);
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 4520KB
stdin
Standard input is empty
stdout
3の倍数の個数=33
3の倍数の合計=1683