#include <iostream> using namespace std; void draw(int n,int x) { if(x<=n) { cout<<n<<"*"<<x<<"="<<n*x<<" "; draw(n,x+1); } } void draw(int n) { if(n>0) { draw(n-1); draw(n,1); cout<<endl; } } int main(void) { draw(9); return 0; }
/*for循环算法*/ #include <iostream> using namespace std; int main() { for(int i=1;i<=9;i++) { for(int j=1;j<=i;j++) cout<<i<<"*"<<j<<"="<<i*j<<" "; cout<<endl; } return 0; }
转载于:https://www.cnblogs.com/tinaluo/p/5248898.html
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/109128.html原文链接:https://javaforall.net