明解习题4-15 带横纵标题

来源:互联网 发布:ios开发数据存储 编辑:程序博客网 时间:2024/06/05 03:18

/*9*9multiplication table*/
#include<stdio.h>
int main()
{
    int x,y; //x :vertical axis;y:horizontal axis
    for(y=0;y<=9;y++) {if(y==0) printf("   |");//4bits
                       else printf("%4d",y);}//the first line
    printf("\n");//
    for(y=0;y<=9;y++) { printf("----");}//the second line,4bits
    for(x=1;x<=9;x++)
        {printf("\n\n%3d|",x);//3bits+|
            for(y=1;y<=9;y++)
                 {
                         printf("%4d",x*y) ;}


        }
        putchar('\n');


return(0);
}


原创粉丝点击