1004 编程求1*2*3*...*n
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int c = 1;
int s = 1;
while(c <= n)
{
s=s*c;
c++;
}
cout<<s;
return 0;
}
2 找不到或者符号
#include<iostream>
using namespace std;
int main()
{
int c = 1;
int sum = 0;
while(c <= 1000)
{
int g =c/1%10;
int s =c/10%10;
int b =c/100%10;
if(g == 3 && s == 3 && b == 3)
{
cout<<c<<endl;
sum++;
}
}
cout<<sum;
return 0;
}
3
或者
4
或者