一、乘法口诀表
<span style="font-size:14px;">#include <iostream>
using namespace std;
int main()
{
int a,b,c;
for(a=1;a<=9;a++)
{
for(b=1;b<=a;b++)
{
c=a*b;
cout<<a<<"×"<<b<<"="<<c<<" ";
}
cout<<endl;
}
}</span><span style="font-size:12px;"> </span><span style="font-size:18px;"> </span>
二、分数的累加求和
<span style="font-size:14px;">#include<iostream>
using namespace std;
int main()
{
double sum=0,a=1,b=3,s=1;
while (a<=19 && b<=210)
{
sum=sum+a/b*s;
a+=2;
b+=2;
s=-s;
}
cout<<"求得1/3-3/5+5/7-7/9+...+19/21="<<sum<<endl;
return 0;
}</span>
#include<iostream.h>
void main()
{
long double sum=0;
int y;
for(y=1;y<=1000;y++)
{
sum=0;
int x;
for(x=1;x<y;x++)
{
if(y%x==0)
sum=sum+x;
}
if(y==sum)
cout<<y<<"\t";
}
}