第六次作业

来源:互联网 发布:java 当前时间加一天 编辑:程序博客网 时间:2024/06/07 12:25
#include<iostream>    using namespace std;    void main()    {        int i,j,k;        for(i = 2;i <= 1000;i++)        {            k = 0;            for(j = 1; j < i;j++)            {                if(i % j == 0)                    k = k + j;                else                    k = k;            }            if(i == k)                cout<<i<<" ";        }        cout<<endl;    }   <pre name = "code" class = "cpp"> #include <iostream>                using namespace std;                int main()        {            double s = 0,a = 0.01;            int ss = 0;            for(int i = 1;i <= 30;i++)            {                ss += 100000;                s += a;                a *= 2;                cout<<"i:"<<i<<"\tss: "<<ss<<"\ts: "<<s<<endl;            }            return 0;        }  
#include <iostream>    using namespace std;    int main()    {        int x,y,z;        for(x = 0; x <= 20; x++)            for(y = 0; y <= 33; y++)        {            z = 100 - x - y;            if(z % 3 == 0 && 5 * x + 3 * y + z / 3 == 100)                cout<<"鸡翁"<<x<<"鸡母"<<y<<"鸡雏"<<z<<endl;        }        return 0;    }   


0 0