How to compute the digits of an irrational number one by one?
问题 I want to read digit by digit the decimals of the sqrt of 5 in C. The square root of 5 is 2,23606797749979..., so this'd be the expected output: 2 3 6 0 6 7 9 7 7 ... I've found the following code: #include<stdio.h> void main() { int number; float temp, sqrt; printf("Provide the number: \n"); scanf("%d", &number); // store the half of the given number e.g from 256 => 128 sqrt = number / 2; temp = 0; // Iterate until sqrt is different of temp, that is updated on the loop while(sqrt != temp){ /