欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長(zhǎng)資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          c 語言怎么實(shí)現(xiàn)三個(gè)數(shù)大小排序

          c 語言怎么實(shí)現(xiàn)三個(gè)數(shù)大小排序

          c 語言怎么實(shí)現(xiàn)三個(gè)數(shù)大小排序?

          c語言實(shí)現(xiàn)三個(gè)數(shù)大小排序的方法:

          從控制臺(tái)輸入三個(gè)整數(shù)a,b,c,實(shí)現(xiàn)對(duì)這 3 個(gè)整數(shù)由小到大進(jìn)行排序,使用 if 語句進(jìn)行條件判斷,如果 a 大于 b,則借助于中間變量 temp 互換 a 與 b 值, 依此類推比較 a 與 c、b 與 c,最終結(jié)果即為 a、b、c 的升序排列。

          代碼:

          #include <stdio.h> int main() { int a, b, c, temp; scanf_s("%d%d%d", &a, &b, &c); if (a > b) { temp = a; a = b; b = temp; } if(a>c) { temp = a; a = c; c = temp; } if (b > c) { temp = b; b = c; c = temp; } printf("%d %d %d", a, b, c); return 0; }

          推薦教程:《C視頻教程》

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)