用C语言实现笑脸和音符的三角形输出
时间: 2024-05-06 10:15:20 浏览: 18
以下是用C语言实现笑脸和音符的三角形输出的示例代码:
笑脸:
```
#include <stdio.h>
int main() {
printf(" **** \n");
printf(" ** ** \n");
printf(" ** ** \n");
printf(" ** ** \n");
printf(" ** ** \n");
printf(" ** 0 0 ** \n");
printf(" ** ** \n");
printf(" ** ** \n");
printf(" **** \n");
return 0;
}
```
音符:
```
#include <stdio.h>
int main() {
printf(" /\\ \n");
printf(" / \\ \n");
printf(" / \\ \n");
printf(" / \\ \n");
printf(" /________\\ \n");
return 0;
}
```
注意:以上代码只是一个示例,输出的效果可能因不同终端而异。
相关问题
c语言实现笑脸和音符的三角形输出
以下是C语言实现笑脸和音符的三角形输出的代码:
笑脸的三角形输出:
```c
#include <stdio.h>
int main() {
printf(" *\n");
printf(" * *\n");
printf(" * *\n");
printf(" * \\ / *\n");
printf(" * O *\n");
printf("* U *\n");
printf(" * \\/ *\n");
printf(" * *\n");
printf(" * *\n");
printf(" * *\n");
printf(" *\n");
return 0;
}
```
音符的三角形输出:
```c
#include <stdio.h>
int main() {
printf(" * \n");
printf(" ***\n");
printf(" *****\n");
printf(" *******\n");
printf(" *********\n");
printf(" ***********\n");
printf("*************\n");
printf(" *\n");
printf(" *\n");
printf(" *\n");
return 0;
}
```
希望能对你有所帮助!
C语言实现笑脸和音符的三角形输出
下面是C语言实现笑脸和音符的三角形输出的代码:
```
#include <stdio.h>
int main() {
printf("笑脸三角形:\n");
printf(" %c%c\n", 1, 1);
printf(" %c %c\n", 1, 1);
printf(" %c %c\n", 1, 1);
printf(" %c %c\n", 1, 1);
printf("%c%c%c%c%c%c%c%c%c\n", 1, 1, 1, 1, 1, 1, 1, 1, 1);
printf("\n音符三角形:\n");
printf(" %c\n", 2);
printf(" %c%c%c\n", 2, 2, 2);
printf(" %c%c%c%c%c\n", 2, 2, 2, 2, 2);
printf(" %c%c%c%c%c%c%c\n", 2, 2, 2, 2, 2, 2, 2);
printf("%c%c%c%c%c%c%c%c%c%c\n", 2, 2, 2, 2, 2, 2, 2, 2, 2, 2);
return 0;
}
```
运行结果如下:
```
笑脸三角形:
☺☺
☺ ☺
☺ ☺
☺ ☺
☺☺☺☺☺☺☺☺☺
音符三角形:
♫
♫♫♫
♫♫♫♫♫
♫♫♫♫♫♫♫
♫♫♫♫♫♫♫♫♫♫
```
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)