Hi.
I study C. I have a real variable "r" and I cannot assign a value of 1/7 to it directly. Here it goes:
This program returns 1/7=0.000000Code:main() { float r; r=1/7; printf("1/7=%.6f\n",r); getch(); }
While the second program with a source code
returns 1/7=0.142857Code:main() { float r,r1; r1=7; r=1/r1; printf("1/7=%.7f\n",r); getch(); }
So, in C language I cannot assign a value of 1/7 directly? Or am I doing something wrong?
Thank you for help.