c语言打印99乘法表

来源:百度知道 编辑:UC知道 时间:2024/05/09 01:19:23
求大侠告诉我怎样用c语言编写程序实现打印下三角形乘法表
是这种样子啊
1*1=1 1*2=2 1*3=3 1*4=4 1*5=5 1*6=6 1*7=7 1*8=8 1*9=9
2*2=4 2*3=6 2*4=8 2*5=10 2*6=12 2*7=14 ……
3*3=9 3*4=12 3*5=15 ……………………………………
4*4=16 4*5=20 4*6=24 ……………………
5*5=25 5*6=30 ……………………
6*6=36 ……………………
7*7=49 ……………………
8*8=64
9*9=81

#include<stdio.h>
main(){
int i,j;
for(i=1;i<=9;i++){
for(j=1;j<=9;j++){
if(j>i)break;
else printf("%d×%d=%5d",i,j,i*j);
}
printf("\n");
}
}

#include "stdio.h"
main()
{
int i,j,result;
for (i=1;i<10;i++)
{ for(j=1;j<10;j++)
{

if(j>i)break;
result=i*j;
printf("%d*%d=%d ",i,j,result);
}
printf("\n");
}

#include<stdio.h>

左下三角的应该是:
main(){
int i,j;
for(i=1;i<=9;i++){
for(j=1;j<=9;j++){
if(j>i)break;
else printf("%5d",i*j);
}
printf("\n");
}
}
右上三角的应该是:
main(){
int i,j;
for(i=1;i<=9;i++){
for(j=1;j<=9;j++){
if(j<i)printf(" ");//五个空格对齐
else printf("%5d",i*j);