91年普考計概 - 普考
By Skylar Davis
at 2016-12-13T16:14
at 2016-12-13T16:14
Table of Contents
下列C程式會印出何值?
#include<stdio.h>
void main(void){
int n=0;
if(n=0)n=1;
else if(n=1)n=2;
else if(n=2)n=3;
else if(n=3)n=4;
printf("%d\n",n);
}
請教各位資訊前輩
小弟認為此題答案應該為1
因n一開始被指派為0
而在if的第一個條件式if(n=0)也符合
照理來說應該不會在執行下方程式
但答案卻是2
不知是哪裡沒有想清楚
還請各位資訊前輩教導 感恩
--
#include<stdio.h>
void main(void){
int n=0;
if(n=0)n=1;
else if(n=1)n=2;
else if(n=2)n=3;
else if(n=3)n=4;
printf("%d\n",n);
}
請教各位資訊前輩
小弟認為此題答案應該為1
因n一開始被指派為0
而在if的第一個條件式if(n=0)也符合
照理來說應該不會在執行下方程式
但答案卻是2
不知是哪裡沒有想清楚
還請各位資訊前輩教導 感恩
--
Tags:
普考
All Comments
By Charlotte
at 2016-12-14T15:53
at 2016-12-14T15:53
By Lauren
at 2016-12-17T03:17
at 2016-12-17T03:17
By Connor
at 2016-12-18T02:23
at 2016-12-18T02:23
By Dorothy
at 2016-12-18T17:22
at 2016-12-18T17:22
By Regina
at 2016-12-20T04:32
at 2016-12-20T04:32
By Linda
at 2016-12-23T15:55
at 2016-12-23T15:55
By Elizabeth
at 2016-12-28T10:43
at 2016-12-28T10:43
By Robert
at 2017-01-01T11:50
at 2017-01-01T11:50
By Wallis
at 2017-01-03T02:20
at 2017-01-03T02:20
By Dinah
at 2017-01-07T21:21
at 2017-01-07T21:21
Related Posts
關於政治學以及地方自治的函授
By Wallis
at 2016-12-13T11:18
at 2016-12-13T11:18
請問這次地特 資料處理大家考得如何?
By Daniel
at 2016-12-12T20:08
at 2016-12-12T20:08
高普考題庫班值得上嗎?
By Harry
at 2016-12-12T16:01
at 2016-12-12T16:01
金融保險用書
By Todd Johnson
at 2016-12-12T12:53
at 2016-12-12T12:53
105年四等法警、警特雙榜
By Bennie
at 2016-12-12T11:43
at 2016-12-12T11:43