课上作业补交-main参数-21-11-15
main:
#include <stdio.h>
#include <stdlib.h>
int sum(int A);
int main(int argc, char *argv[]){
int result = 0;
result = sum(atoi(argv[1]));
printf("各位相加的和是:%d\n",result);
return 0;
}
sum:
int sum(int A){
int result;
result = 0;
while(A > 0){
result += A%10;
A /= 10;
}
return result;
}