温馨提示×

c语言怎么输出两行不同的文字

小亿
353
2023-11-06 10:59:25
栏目: 编程语言

在C语言中,可以使用printf函数来输出文字。如果要输出两行不同的文字,可以在两次printf函数调用中分别指定不同的文字。

下面是一个示例代码:

#include <stdio.h>

int main() {
    printf("Hello, world!\n");  // 输出第一行文字
    printf("This is a new line.\n");  // 输出第二行文字

    return 0;
}

运行以上代码,将会输出:

Hello, world!
This is a new line.

其中,\n是转义字符,表示换行。

0