輸入 x 後
算出 x * (x - 1) +2
答案:
include<iostream>
using namespace std;
int main()
{
{
int x;
while (cin >> x)
{
cout << x * (x - 1) + 2 <<"\n";
}
}
}
輸入 x 後
算出 x * (x - 1) +2答案:
include
using namespace std;
int main()
{
{
int x;
while (cin >> x)
{cout << x * (x - 1) + 2 <<"\n";
}
}
}
如果遇到1就會錯了