7. The output shape is right triangle 99 multiplication table. The shape is as follows://* 1 2 3 4 5 6 7 8 9//1 1 2 2 4//3 3 6 9//4 4 8 12 16//5 5 10 15 20 25//6 6 12 18 24 30 36//7 7 14 21 28 35 42 49//8 8 16 24 32 40 48 56 64 //9 9 18 27 36 45 54 63 72 81//This is the code I wrote myself, and here's the book.The code #include<stdio.h>int main () {int i,j;printf ("* ");//The asterisk for (i=1;i<=9;i++) that starts with a separate output printf ("%d ", I);//With A for () loop, output a row from 1 to 9, which is the first row of printf ("\ n") of the multiplication table; for (i=1;i<=9;i++) //needs { . //himself printf ("%d ", I); //comprehend for (j=1;j<=i;j++) / /。。。 printf ("%d ", I*j), //,,,printf ("\ n"); //}return 0;} This is the code written in the book/* #include <stdio.h>int main (void) {int i,j,k;printf ("*"); for (i=1;i<10;i++) printf (" %4d ", i);//The first row of printf (" \ n ") is first output with a for () loop, and for (j=1;j<10;j++) //requires { //himself printf ("%2d", j); //comprehend for (k=1;k<=j;k++) //... printf ("%4d", j*k); //... printf ("\ n");} return 0;} */
8, increasing herd: If a heifer, starting from the 4th year, the annual birth of a cow, according to the law,//The number of cows in the first n years? /* #include <stdio.h>int main () {int i,year,oxnum,oxnum1,oxnum2,oxnum3;printf ("Enter Year:"); scanf ("%d",& year), for (i=1;i<=year;i++) {if (i<4) Oxnum=oxnum1=oxnum2=oxnum3=1;else{oxnum=oxnum1+oxnum3;oxnum3=oxnum2;o Xnum2=oxnum1;oxnum1=oxnum;} printf ("I=%2d ox number=%3d\n", i,oxnum);} return 0;} */
This article from "Peng Brother's Blog" blog, declined reproduced!
C Language Example series-------fourth day