编写C语言程序(打印九九乘法表)


用C++编写程序(打印九九乘法表)

#include "stdio.h'

#include "stdlib.h'


int main()

{

 int i, j;

 for (i = 1; i < 10; i++)

  printf("%-2d ", i);

 printf(" ");

 for (i = 1; i < 亮蚂10; i++)

  printf("-  ");

 printf(" ");

 for (i = 1; i < 10; i++)

 {

  for (j 辩键含= 1; j < i; j++)

   printf("   ");

  for (; j < 10; j++)

   printf("%-2d ", i 携笑* j);

  printf(" ");

 }

 return 0;

}


/*写的不洞镇困错,也挺好动,你看下,截旅此了个图*/
#include <stdio.h>
#include <conio.h>

int main(void)
{
int table_size = 0; /* Table size */

printf("Enter the table size (from 2 to 12): ");
scanf("%d", &table_size);
if(table_size>12)
{
printf("\nTable size must not exceed 12 - setting to 12");
table_size = 12;
}
else if(table_size<2)
{
printf("\nTable size must be at least 2 - setting to 2");
table_size = 2;
}

for(int row = 0 ; row<=table_size ; row++)
{
printf("\n"); /* Start new row */
for(int col = 0 ; col<=table_size ; col++)
{
if(row == 0) /* 1st row? */
{ /* Yes - output column headings */
if(col == 0) /* 1st column? */
printf(" "纳念); /* Yes - no heading */
else
printf("|%4d", col); /*No - output heading */
}
else
{ /* Not 1st row - output rows */
if(col == 0) /* 1st column? */
printf("%4d", row); /* Yes - output row label */
else
printf("|%4d", row*col); /* No - output table entry */
}
}
if(row == 0 ) /* If we just completed 1st row */
{ /* output separator dashes */
printf("\n");
for(int col=0 ; col<=table_size ; col++)
printf("_____");
}
}
printf("\n");
getch();
return 0;
}
#include <stdio.h>
void main()
{
int i,j,k;
for(i=1;i<=9;i++)
{
for(j=1;j<=i;j++)
{
k=i*j;printf("%d*%d=%d ",i,j,k);
}
printf("缓饥轮扰信\肢闹n");
}
}
右边,"您可能想知道"那里很多。自己挑下。