單項選擇題
從鍵盤任意輸入一個實數,不使用計算絕對值函數編程計算并輸出該實數的絕對值。 按要求在空白處填寫適當的表達式或語句,使程序完整并符合題目要求。 #include <stdio.h> int main() { float x; printf("Input a float number:"); scanf("%f", &x); ______________; printf("Absolute value of x is %f/n", x); return 0; }
A、if (x < 0) x = -x
B、x = -x
C、if (x > 0) continue
D、if (x > 0) x = x
A.h>