终于要在这里安家了, 先发点东西测试一下, 呵呵
求n!的末尾有多少个零......
#include
<
iostream
>
using namespace std;
int main()
... {
long n = 0, count = 0;
cout << "Input n, and I'll tell u how many 0s in the end of n!" ;
cin >> n;
for (int i = 5; i <= n; i += 5)
...{
++count;
if (!(i%25)) ++count;
}
cout << "The number of 0s in the end of n! is: " << count;
return 0;
}
using namespace std;
int main()
... {
long n = 0, count = 0;
cout << "Input n, and I'll tell u how many 0s in the end of n!" ;
cin >> n;
for (int i = 5; i <= n; i += 5)
...{
++count;
if (!(i%25)) ++count;
}
cout << "The number of 0s in the end of n! is: " << count;
return 0;
}
贴代码的功能很好哦...呵呵
自己学编程学了这么多年, 断断续续的, 最终也没学到什么有用的东西, 现在终于能从头开始系统的学习了, 这是一个新的开始, 告诉自己, 加油!