fork download
  1. #include <stdio.h>
  2.  
  3.  
  4.  
  5. int main()
  6.  
  7. {
  8.  
  9.  
  10.  
  11. long double f;
  12.  
  13. int x;
  14.  
  15.  
  16.  
  17. long double a = 1;
  18.  
  19.  
  20.  
  21. printf("제곱근을 찾을 수 입력:\n");
  22.  
  23. scanf("%.14f",&f);
  24.  
  25.  
  26.  
  27. printf("소수접 자리 수 :\n");
  28.  
  29. scanf("%d",&x);
  30.  
  31. x=x+1;
  32.  
  33.  
  34.  
  35.  
  36.  
  37. long double i = 0;
  38.  
  39.  
  40.  
  41. for (int j=0;j<x;j++)
  42.  
  43. {
  44.  
  45.  
  46.  
  47. while (i*i<=f)
  48.  
  49. i=i+(1/a);
  50.  
  51.  
  52.  
  53. i=i-(1/a);
  54.  
  55.  
  56.  
  57. printf("%.14f\n",i);
  58.  
  59.  
  60.  
  61. a=a*10;
  62.  
  63.  
  64.  
  65. }
  66.  
  67. return 0;
  68.  
  69. }
Success #stdin #stdout 0s 4852KB
stdin
2 10
stdout
제곱근을 찾을 수 입력:
소수접 자리  수 :
0.00000000000000
0.00000000000000
0.00000000000000