C++ while循环打印乘法表-嗨客网

PHOTO EMBED

Thu Dec 08 2022 03:59:44 GMT+0000 (Coordinated Universal Time)

Saved by @leawoliu

#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
	cout << "嗨客网(www.haicoder.net)\n" << endl;
	// 使用循环嵌套,打印乘法表
	int i = 1;
	while (i <= 9)
	{    	
		int j = 1;
    	while (j <= i)
    	{
    		int mul = j * i;
    		cout << j << "*" << i << mul << " ";
	        j += 1;
		}
    	i += 1;
    	cout << endl;
	}
	return 0;
}
content_copyCOPY

https://haicoder.net/cpp/cpp-while-mul-table.html