fork download
  1. #include<stdio.h>
  2.  
  3. int f(int n)
  4. {
  5.  int i, j;
  6. int count;
  7.  char str[100];
  8.  
  9.  count = 0;
  10.  for (i = 1; i <= n; i++) {
  11.   sprintf(str, "%d", i);
  12.   for (j = 0; str[j]; j++) {
  13.    if (str[j] == '1')
  14.     count++;
  15.   }
  16.  }
  17.  return count;
  18. }
  19.  
  20. int main()
  21. {
  22. int num,ans;
  23. puts("nの数は?");
  24. scanf("&d",&num);
  25.  
  26. ans = f(num);
  27. printf("ans=%d\n",ans);
  28.  
  29. return 0;
  30. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:5:1: error: stray ‘\343’ in program
prog.cpp:5:1: error: stray ‘\200’ in program
prog.cpp:5:1: error: stray ‘\200’ in program
prog.cpp:7:1: error: stray ‘\343’ in program
prog.cpp:7:1: error: stray ‘\200’ in program
prog.cpp:7:1: error: stray ‘\200’ in program
prog.cpp:9:1: error: stray ‘\343’ in program
prog.cpp:9:1: error: stray ‘\200’ in program
prog.cpp:9:1: error: stray ‘\200’ in program
prog.cpp:10:1: error: stray ‘\343’ in program
prog.cpp:10:1: error: stray ‘\200’ in program
prog.cpp:10:1: error: stray ‘\200’ in program
prog.cpp:11:1: error: stray ‘\343’ in program
prog.cpp:11:1: error: stray ‘\200’ in program
prog.cpp:11:1: error: stray ‘\200’ in program
prog.cpp:11:1: error: stray ‘\343’ in program
prog.cpp:11:1: error: stray ‘\200’ in program
prog.cpp:11:1: error: stray ‘\200’ in program
prog.cpp:12:1: error: stray ‘\343’ in program
prog.cpp:12:1: error: stray ‘\200’ in program
prog.cpp:12:1: error: stray ‘\200’ in program
prog.cpp:12:1: error: stray ‘\343’ in program
prog.cpp:12:1: error: stray ‘\200’ in program
prog.cpp:12:1: error: stray ‘\200’ in program
prog.cpp:13:1: error: stray ‘\343’ in program
prog.cpp:13:1: error: stray ‘\200’ in program
prog.cpp:13:1: error: stray ‘\200’ in program
prog.cpp:13:1: error: stray ‘\343’ in program
prog.cpp:13:1: error: stray ‘\200’ in program
prog.cpp:13:1: error: stray ‘\200’ in program
prog.cpp:13:1: error: stray ‘\343’ in program
prog.cpp:13:1: error: stray ‘\200’ in program
prog.cpp:13:1: error: stray ‘\200’ in program
prog.cpp:14:1: error: stray ‘\343’ in program
prog.cpp:14:1: error: stray ‘\200’ in program
prog.cpp:14:1: error: stray ‘\200’ in program
prog.cpp:14:1: error: stray ‘\343’ in program
prog.cpp:14:1: error: stray ‘\200’ in program
prog.cpp:14:1: error: stray ‘\200’ in program
prog.cpp:14:1: error: stray ‘\343’ in program
prog.cpp:14:1: error: stray ‘\200’ in program
prog.cpp:14:1: error: stray ‘\200’ in program
prog.cpp:14:1: error: stray ‘\343’ in program
prog.cpp:14:1: error: stray ‘\200’ in program
prog.cpp:14:1: error: stray ‘\200’ in program
prog.cpp:15:1: error: stray ‘\343’ in program
prog.cpp:15:1: error: stray ‘\200’ in program
prog.cpp:15:1: error: stray ‘\200’ in program
prog.cpp:15:1: error: stray ‘\343’ in program
prog.cpp:15:1: error: stray ‘\200’ in program
prog.cpp:15:1: error: stray ‘\200’ in program
prog.cpp:16:1: error: stray ‘\343’ in program
prog.cpp:16:1: error: stray ‘\200’ in program
prog.cpp:16:1: error: stray ‘\200’ in program
prog.cpp:17:1: error: stray ‘\343’ in program
prog.cpp:17:1: error: stray ‘\200’ in program
prog.cpp:17:1: error: stray ‘\200’ in program
prog.cpp: In function ‘int main()’:
prog.cpp:24:17: warning: too many arguments for format [-Wformat-extra-args]
stdout
Standard output is empty