int main(void)
{
int x = 10, y = 3;
printf("x /y = %f\n", x/y);
return 0;
}
2.有個學生為了修正上一個問題之錯誤,而改寫程式如下,但結果仍然不對,請問錯誤在哪邊?
#include <stdio.h>
int main(void)
{
int x = 10, y = 3;
float z;
z = x / y;
printf("x / y = %f\n", z);
return 0;
}
3.下面這個程式用來比較x與y是否相等,但程式執行結果有誤,請問哪邊出了錯誤?
#include <stdio.h>
int main(void)
{
int x, y;
printf("x = ");
scanf("%d", &x);
printf("y = ");
scanf("%d", &y);
if (x = y)
printf("x = y");
return 0;
}
下面這個程式顯示結果有些不正常,請問應如何修改?
#include <stdio.h>
int main(void)
{
int x = 10, y = 3;
printf("x % y = %d\n", x%y);
return 0;
}