第一题、
int main()
{
int a=1000;
while(a<10000)
{
int q=a/1000;
int b=a/100%10;
int s=a/10%10;
int g=a%10;
if(((10*q+b)+(10*s+g))*((10*q+b)+(10*s+g))==a)
{
cout<<a<<endl;
}
a++;
}
system("pause");
return 0;
}
第二题、
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a=1;
while(1<=a&&a<=500)
{
if(a%3==2&&a%5==3&&a%7==2)
{
cout<<a<<endl;
}
a++;
}
system("pause");
return 0;
}
第三题、
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a;
cin>>a;
int b=1;
int c=1;
while(b<=a)
{
c=c*b;
b++;
}
cout<<c<<endl;
system("pause");
return 0;
}
第四题、
#include<bits/stdc++.h>
using namespace std;
int main()
{
int b=0;
int c=100;
while(c>=1)
{
b=b+c;
c=c-3;
}
cout<<b<<endl;
system("pause");
return 0;
}
第五题、
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int b=0;
int c=1;
while(c<=n)
{
b=b+c;
c++;
}
cout<<b<<endl;
system("pause");
return 0;
}
第六题、
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int b=0;
int c=1;
if(n%2!=0)
{
while(c<=n)
{
b=b+c;
c=c+2;
}
cout<<b<<endl;
}
system("pause");
return 0;
}