#9672: 請問各位大大哪裡錯??(C語言)


ricciyeh880427 (葉豪豪)

School : 新北市立三重高級中學
ID : 47804
IP address : [1.163.164.143]
Last Login :
2019-11-19 11:15:32
d277. 矩形对角线 | From: [36.231.64.87] | Post Date : 2015-02-23 11:57

/* d277 矩形对角线 */
# include <stdio.h>
int main()
{
int i;
while(scanf("%d", &i)!=EOF)
{
if(i%2==0)
printf("%d", i);
else if(i%2!=0)
printf("%d", i-1);
}
return 0;
}
 
#9674: Re:請問各位大大哪裡錯??(C語言)


dse12345z (dse12345z)

School : No School
ID : 47834
IP address : [123.51.221.44]
Last Login :
2018-07-31 17:08:45
d277. 矩形对角线 | From: [114.43.215.101] | Post Date : 2015-02-24 14:18

/* d277 矩形对角线 */
# include
int main()
{
int i;
while(scanf("%d", &i)!=EOF)
{
if(i%2==0)
printf("%d", i);
else if(i%2!=0)
printf("%d", i-1);
}
return 0;
}

 

輸出多加換行就可以了

printf("%d\n", i); 

printf("%d\n", i-1); 

 
ZeroJudge Forum