.. (לתיקייה המכילה) | ||
Q: Can we use the function sqrt? | |
A: You can only use the libraries stdio.h and stdbool.h, therefore you can't use the function sqrt. |
Q: Can we use malloc? | |
A: From the same reason mentioned above you can't. However, in C99 you can define an array with variable size, for example: int x=5; int a[x]; For more examples and explanations, see tutorial 5. |
Q: Is zero considered a positive number? | |
A: No. |
Q: When the last input is a fraction (where an integer is expected), the program doesn't recognize it as an error. Is it o.k? | |
A: Yes. When the input is a fraction, for example 3.5, the program gets 3 as an integer input, and the ".5" remains in the buffer (if you can't remeber why, see tutorial 4). So if the last input is a fraction, there is no reason to return an error. In general, any behavior which is consistent with receiving the numbers with scanf("%d") is OK. |