【C語言 & C++】對齊輸出九九乘法口訣
阿新 • • 發佈:2019-02-07
//對齊輸出九九乘法口訣 #include <iostream> #include <iomanip.h> //using namespace std; int main() { int i,j; for(i=1;i<=9;i++) { for(j=1;j<=i;j++) { cout<<i<<"*"<<j<<"="<<setw(2)<<i*j<<" "; } cout<<endl; } return 0; } /* #include <stdio.h> int main() { int i,j; for(i=1;i<=9;i++) { for(j=1;j<=i;j++) { printf("%2d*%2d=%2d ",i,j,i*j); } printf("\n"); } return 0; } */ <img src="https://img-blog.csdn.net/20150516100750270?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZG91ZG91d2ExMjM0/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />