use C program [Input] # 5 10 [Output] ########## ########## ########## ########## ##########
时间: 2024-02-27 12:59:24 浏览: 30
Sure, here's a simple C program that takes two integers as input and prints out a line of "#" characters with a length specified by the first integer, repeated on multiple lines specified by the second integer:
```c
#include <stdio.h>
int main() {
int numChars, numLines;
printf("Enter the number of characters per line: ");
scanf("%d", &numChars);
printf("Enter the number of lines: ");
scanf("%d", &numLines);
for (int i = 0; i < numLines; i++) {
for (int j = 0; j < numChars; j++) {
printf("#");
}
printf("\n");
}
return 0;
}
```
When you run this program, it will prompt the user to enter the number of characters per line and the number of lines to print. It then uses two nested loops to print out a line of "#" characters with a length specified by the `numChars` variable, repeated on multiple lines specified by the `numLines` variable.
For example, if the user enters 5 and 10 as the input values, the program will output:
```
Enter the number of characters per line: 5
Enter the number of lines: 10
#####
#####
#####
#####
#####
#####
#####
#####
#####
#####
```