delete pics to save space
This commit is contained in:
26
history_source/ccf 入门篇/U4/4.2.2.cpp
Normal file
26
history_source/ccf 入门篇/U4/4.2.2.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int f,i,s,a;
|
||||
while(true)
|
||||
{
|
||||
i=0;
|
||||
s=0;
|
||||
cin>>f;
|
||||
while(true)
|
||||
{
|
||||
a=f;
|
||||
a=a/pow(10,i);
|
||||
if(a==0) break;
|
||||
else
|
||||
{
|
||||
a=a%10;
|
||||
s=s+a;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
cout<<s<<endl;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user