µÎ º¯¼ö¸¦ ÀÔ·Â ¹Þ½À´Ï´Ù.scanf("%d%d",&from,&to);from <= to ÀÎ °ü°èÀÌ¸é ´ÙÀ½°ú °°ÀÌ ÇØ°áÇÒ ¼ö ÀÖ½À´Ï´Ù.for( i = from ; i <= to ; i++){ printf("%d ",i); }±×·¯³ª from > to À̸é À§ ¼Ò½º´Â ¾Æ¹«°Íµµ Ãâ·ÂµÇÁö ¾Ê½À´Ï´Ù. ¹Ýº¹¹®¿¡¼ ¹Ù·Î ºüÁ® ¹ö¸³´Ï´Ù.À̸¦ ÇØ°áÇÏ´Â ¹æ¹ýÀº from <= to À̸é À§ ¼Ò½º´ë·Î ¾Æ´Ï¸é to ¿¡¼ from À¸·Î Ãâ·ÂÇÏ¸é µË´Ï´Ù.
if ( from < = to ) { for( i = from ; i <= to ; i++){ printf("%d ",i); } }else { for( i = to ; i <= from ; i++){ printf("%d ",i); } }ÇÏÁö¸¸ ÀÌ ¹æ¹ýº¸´Ù Ç×»ó from <= to ÀÎ °ü°è·Î À¯ÁöÇÏ¸é¼ ¹Ýº¹ ½ÃÅ°´Â°Ô Á¶±Ý ´õ ³ª¾Æ º¸ÀÔ´Ï´Ù.if ( from > to ) { // from > to À̸é swap t = from; from = to; to = t; } for( i = from ; i <= to ; i++){ printf("%d ",i); }