Board logo

標題: [隨堂測驗] while 迴圈 (四) - 九九乘法表 [打印本頁]

作者: 方浩葦    時間: 2024-4-19 11:32     標題: [隨堂測驗] while 迴圈 (四) - 九九乘法表

利用 while 迴圈列印出如下排列之九九乘法表:



本帖隱藏的內容需要回復才可以瀏覽

作者: 鄭豊翰    時間: 2024-5-4 16:06

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int i=1;
  7.     while(i<=9)
  8.     {
  9.         int a=1;
  10.                 while(a<=9)
  11.                 {
  12.                         cout<<i<<"*"<<a<<"="<<i*a<<"\t";
  13.                         a++;
  14.                 }
  15.                 cout<<endl;
  16.                 i++;
  17.     }
  18.     system("pause");
  19.     return 0;   
  20. }
複製代碼
複製代碼





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/) Powered by Discuz! 7.2