[問題] 指派
我在寫ZJ的d468: 簡單求冪題
http://zerojudge.tw/ShowProblem?problemid=d468
編譯器(Dev C)告訴我else 前面的分號有問題
然後我把 ans = a; 這行注釋掉就沒問題了
但這樣一來這個程式不就沒用了0.0
請問各位大大為什麼會這樣呢??
#include <stdio.h>
int main () {
long long a, n, i, ans;
while (scanf("%lld", &a) != EOF) {
scanf("%lld", &n);
if (a == 0 && n == 0) {
printf("All Over.\n");
break;
}
ans = a;
else {
for (i = 0; i < n; i++) {
ans = ans*a;
}
printf("%lld", ans);
}
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.60.107.233
※ 編輯: xatier 來自: 210.60.107.233 (10/05 16:26)
→
10/05 16:31, , 1F
10/05 16:31, 1F
→
10/05 16:32, , 2F
10/05 16:32, 2F
→
10/05 16:42, , 3F
10/05 16:42, 3F
→
10/05 16:43, , 4F
10/05 16:43, 4F
→
10/05 16:43, , 5F
10/05 16:43, 5F
→
10/05 16:49, , 6F
10/05 16:49, 6F