NP2. 多行输出
描述
将字符串 'Hello World!' 存储到变量str1中,再将字符串 'Hello Nowcoder!' 存储到变量str2中,再使用print语句将其打印出来(一行一个变量)。输入描述
无输出描述
第一行输出字符串Hello World!,第二行输出字符串Hello Nowcoder!C 解法, 执行用时: 2ms, 内存消耗: 292KB, 提交时间: 2022-05-26
#include<stdio.h> int main(){ char a[15] = "Hello World!"; char b[15] = "Hello Nowcoder!"; printf("%s",a); printf("\n"); printf("%s",b); }
C 解法, 执行用时: 2ms, 内存消耗: 292KB, 提交时间: 2022-05-25
#include<stdio.h> int main() { char *str1 = "Hello World!"; char *str2 = "Hello Nowcoder!"; printf("%s\n",str1); printf("%s\n",str2); return 0; }
Python 解法, 执行用时: 9ms, 内存消耗: 2840KB, 提交时间: 2022-08-04
str1 = "Hello World!" str2 = "Hello Nowcoder!" print(str1 + "\n" + str2)
Python 解法, 执行用时: 9ms, 内存消耗: 2844KB, 提交时间: 2022-08-01
str1 ='Hello World!' str2 = 'Hello Nowcoder!' print(str1) print(str2)
Python 解法, 执行用时: 9ms, 内存消耗: 2844KB, 提交时间: 2022-08-01
str = 'Hello World!' str2 = 'Hello Nowcoder!' print (str) print (str2)