2 条题解

  • 1
    @ 2024-1-4 0:44:46
    #include<stdio.h>
    int main() {
    	int n;
    	scanf("%d",&n);
    	int a=n/100,b=n/10%10,c=n%10;
    	printf("%d\n",a+b+c);
    	return 0;
    }
    
    • 0
      @ 2024-11-25 21:49:47

      #include <stdio.h>

      int main() { int x, sum = 0; scanf("%d", &x); while (x > 0) { sum += x % 10; // 取出个位数字并加到sum上 x /= 10; // 去掉个位数字 } printf("%d\n", sum); return 0; }

      • 1

      信息

      ID
      4
      时间
      1000ms
      内存
      16MiB
      难度
      3
      标签
      递交数
      215
      已通过
      110
      上传者