fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4.  
  5. {
  6.  
  7. double light_speed = 300000;
  8.  
  9. double distance = 149600000;
  10.  
  11.  
  12.  
  13.  
  14. double time;
  15.  
  16.  
  17.  
  18.  
  19. time = distance / light_speed;
  20.  
  21. time = time / 60.0;
  22.  
  23.  
  24.  
  25.  
  26. printf("빛의 속도는 %fkm/s n", light_speed);
  27.  
  28. printf("태양과 지구와의 거리 %fkm n", distance);
  29.  
  30. printf("도달 시간은 %d분 %d초n", (int)time, (int)((time-(int)time)*60));
  31.  
  32. return 0;
  33.  
  34. }
  35.  
Success #stdin #stdout 0s 1832KB
stdin
Standard input is empty
stdout
빛의 속도는 300000.000000km/s n태양과 지구와의 거리 149600000.000000km n도달 시간은 8분 18초n