Home > Back-end > Output half zhang Yang multiplication tables
Output half zhang Yang multiplication tables
Time:03-28
Please output half zhang Yang multiplication tables, that is, the lower triangular half zhang, 1 x 1=1 1=2 x 2 x 2=4 3 * 1=3 3 * 2=6 3 x3=9 ... 9 * 1=9 September 18 9 x 3 x 2==27... 9 * 9=81 Input format: There is no The output format: The result value according to the format of the output below, each method of 2, other numerical accounts for only 1, separated by a space between each pair of, the last also have space, namely the end of each row has a space, such as 1 * 1=1 followed by a space and then press enter to the second line, 1 x 1=1 1=2 x 2 x 2=4 3 * 1=3 3 * 2=6 3 x3=9 ... 9 * 1=9 September 18 9 x 3 x 2==27... 9 * 9=81 Input the sample: There is no The output sample: 1 x 1=1 1=2 x 2 x 2=4 3 * 1=3 3 * 2=6 3 x3=9 ... 9 * 1=9 September 18 9 x 3 x 2==27... 9 * 9=81
My code
#include using namespace std;
Int main () { int i, j; for (i=1; i <=9; I++) { For (j=1; J & lt;=I; J++) { Cout & lt; } Cout & lt; }
return 0; }
Why the PTA show the answer wrong, multiply the result value of two is what mean??
CodePudding user response:
Reference:
# include & lt; Iostream. H> #include using namespace std;
Int main () { int i, j; for (i=1; i <=9; I++) { For (j=1; J & lt;=I; J++) { Cout & lt; } Cout & lt; }
return 0; }
//1 x 1=1 //2, 1=2 x 2 x 2=4 //3 * 1=3 3 * 2=6 3 x3=9 //4 * 1=4 4 * 2=8 4 x3=12 4 * 4=16 //5 * 1=5 5 * 2=10 5 * 3=15 5 * 4=20 5 * 5=25 //6 x 1=6 x 2=12 x3=18 6 x 4=24 * 5=30 6 x6=36 //7 * 1=7 7 * 2=7 * 3=21 July 14 * 4=28 7 * 5=35 7 * 6=42 7 * 7=49 //8 x 1=16 8 x 8 8 x 2=3=24 32 8 x 8 x 4=5=40 48 8 x 8 x 6=7=56 8 x 8=64 //9 * 1=9 9 x 2=18 9 * 3=27 September * 4=36 9 * 5=45 9 * 6=54 9 x 7=63 * 8=72 9 * 9=81 //please press any key to continue...