求一个五个数的和如( 输入12345,1+2+3+4+5=15)用c语言球一个五位数的各个上值的和如12345为1+2+3+4+5=15 是在样写吗 #include main() int x,t; int sum=0; scanf("%d",x); while(x>0) {t=x%10; x=x/10; sum=+t; }printf("%d",sum
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/30 21:26:43
![求一个五个数的和如( 输入12345,1+2+3+4+5=15)用c语言球一个五位数的各个上值的和如12345为1+2+3+4+5=15 是在样写吗 #include main() int x,t; int sum=0; scanf(](/uploads/image/z/3688277-5-7.jpg?t=%E6%B1%82%E4%B8%80%E4%B8%AA%E4%BA%94%E4%B8%AA%E6%95%B0%E7%9A%84%E5%92%8C%E5%A6%82%EF%BC%88+%E8%BE%93%E5%85%A512345%2C1%2B2%2B3%2B4%2B5%3D15%EF%BC%89%E7%94%A8c%E8%AF%AD%E8%A8%80%E7%90%83%E4%B8%80%E4%B8%AA%E4%BA%94%E4%BD%8D%E6%95%B0%E7%9A%84%E5%90%84%E4%B8%AA%E4%B8%8A%E5%80%BC%E7%9A%84%E5%92%8C%E5%A6%8212345%E4%B8%BA1%2B2%2B3%2B4%2B5%3D15+%E6%98%AF%E5%9C%A8%E6%A0%B7%E5%86%99%E5%90%97+%23include+main%28%29+int+x%2Ct%3B+int+sum%3D0%3B+scanf%28%22%25d%22%2Cx%29%3B+while%28x%3E0%29+%7Bt%3Dx%2510%3B+x%3Dx%2F10%3B+sum%3D%2Bt%3B+%7Dprintf%28%22%25d%22%2Csum)
求一个五个数的和如( 输入12345,1+2+3+4+5=15)用c语言球一个五位数的各个上值的和如12345为1+2+3+4+5=15 是在样写吗 #include main() int x,t; int sum=0; scanf("%d",x); while(x>0) {t=x%10; x=x/10; sum=+t; }printf("%d",sum
求一个五个数的和如( 输入12345,1+2+3+4+5=15)用c语言
球一个五位数的各个上值的和如12345为1+2+3+4+5=15 是在样写吗 #include main() int x,t; int sum=0; scanf("%d",x); while(x>0) {t=x%10; x=x/10; sum=+t; }printf("%d",sum); }怎么编译不出
求一个五个数的和如( 输入12345,1+2+3+4+5=15)用c语言球一个五位数的各个上值的和如12345为1+2+3+4+5=15 是在样写吗 #include main() int x,t; int sum=0; scanf("%d",x); while(x>0) {t=x%10; x=x/10; sum=+t; }printf("%d",sum
你的"sum=+t;” 不对啊,应该是 "sum += t" . C代码如下: #include void main() { int x,t; printf("Input a number(10000-99999): "); scanf("%d",&x); int sum=0; if(x>=10000 && x0) { t = x%10; x /= 10; sum += t; } printf("%d\n", sum); else printf("不是五位数"); } }