返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     float a,s,d;
  7.     cout<<"請輸入梯形的上底: ";
  8.     cin>>a;
  9.     cout<<"請輸入梯形的下底: ";
  10.     cin>>s;
  11.     cout<<"請輸入梯形的高: ";
  12.     cin>>d;
  13.     cout<<"上底 "<<a<<",下底 "<<s<<,高"<<d<<"c的梯形,面積是"<<(a+s)*d/2<<endl;
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

  1. #include<cstdlib>
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {   
  6.     int a,i=1;
  7.     cout<<"請輸入一正整數:";
  8.     cin>> a;
  9.     cout<<a<<"的因數:";
  10.     while(i<=a)
  11.     {
  12.     if(a%i==0)
  13.     {
  14.     cout<<i<<' ';
  15.     }
  16.     i++;
  17.     }
  18.     cout<<endl;
  19.     system ("pause");
  20.     return 0;
  21. }
複製代碼

TOP

返回列表