#include <iostream>
using namespace std;
#include <cstdlib>
int fact(int);
int main() {
int a;
do
{
cout<<"input am integer:";
cin>>a;
}while(a<=0);
cout<<"1*2*...*"<<a<<"="<<fact(a)<<endl;
system("pause");
return 0;
}
int fact (int a)
{
if(a>0)
return(a*fact(a-1));
else
return 1;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwojaW5jbHVkZSA8Y3N0ZGxpYj4KaW50IGZhY3QoaW50KTsKaW50IG1haW4oKSB7CglpbnQgYTsKCWRvCgl7CgkJY291dDw8ImlucHV0IGFtIGludGVnZXI6IjsKCQljaW4+PmE7Cgl9d2hpbGUoYTw9MCk7CgkKCWNvdXQ8PCIxKjIqLi4uKiI8PGE8PCI9Ijw8ZmFjdChhKTw8ZW5kbDsKCXN5c3RlbSgicGF1c2UiKTsKCXJldHVybiAwOwp9CmludCBmYWN0IChpbnQgYSkKewoJaWYoYT4wKQoJcmV0dXJuKGEqZmFjdChhLTEpKTsKCWVsc2UKCXJldHVybiAxOwp9