1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <stdio.h> int main(void) { double light_speed = 300000; // ºûÀÇ ¼Óµµ¸¦ ÀúÀåÇÏ´Â º¯¼ö(300000km/sec) double distance = 149600000; // žç°ú Áö±¸ »çÀÌ °Å¸®¸¦ ÀúÀåÇÏ´Â º¯¼ö // 149600000km·Î ÃʱâÈÇÑ´Ù. double time; // ½Ã°£À» ³ªÅ¸³»´Â º¯¼ö time = distance / light_speed; // °Å¸®¸¦ ºûÀÇ ¼Óµµ·Î ³ª´«´Ù. time = time / 60.0; // Ãʸ¦ ºÐÀ¸·Î º¯È¯ÇÑ´Ù. printf("ºûÀÇ ¼Óµµ´Â %lfkm/s \n", light_speed); printf("žç°ú Áö±¸¿ÍÀÇ °Å¸® %lfkm \n", distance); printf("µµ´Þ ½Ã°£Àº %lfÃÊ\n", time); // ½Ã°£À» Ãâ·ÂÇÑ´Ù. return 0; } | cs |