单项选择题

若x和y是程序中的两个整型变量,则下列 if 语句中正确的是

A.if(x!=0) y=1; else y=2;
B.if(x!=0) y=1 else y=2;
C.if(x!=0) then y=1 else y=2;
D.if x!=0 y=1; else y=2;