#include<stdio.h>
int main()
{
unsigned long int a;
int b, c,d;
int sum = 0;
int count = 1;
scanf("%ld", &a);
c = a;
while (c=c/10)
{
count++;
}
b = count;
while(count--)
{
d = a % 10;
sum += d;
a = a / 10;
}
printf("%d %d", b, sum);
}
原文地址:https://blog.51cto.com/14737345/2479858
时间: 2024-11-09 02:10:03