📄 ex4_04.c
字号:
/*Exercise 4.1 Generate a multiplication table */
#include <stdio.h>
int main(void)
{
int width = 0; /* Box width */
int height = 0; /* Box height */
printf("Enter the box width and height size separated by a space: ");
scanf("%d", &width);
scanf("%d", &height);
for(int row = 0 ; row<height ; row++)
{
printf("\n"); /* Start new row */
for(int col = 0 ; col<width ; col++)
{
if(row == 0||row==height-1) /* 1st or last row? */
{
printf("*"); /* Yes - all asterisks */
continue;
}
/* An * in 1st & last column, otherwise a space */
printf("%c", ((col==0 || col==width-1) ? '*' :' '));
}
}
printf("\n");
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -