C Sharp 输出hello
时间: 2024-05-08 07:17:27 浏览: 15
world
```csharp
using System;
class Program {
static void Main() {
Console.WriteLine("Hello world");
}
}
```
输出结果:
```
Hello world
```
相关问题
java接收用户输入的一句英文,将其中的单词以反序输出。"hello c sharp"→"sharp c hello"
```java
import java.util.Scanner;
public class ReverseWords {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("请输入一句英文: ");
String input = scanner.nextLine();
String[] words = input.split(" "); // 使用空格分割单词
for (int i = words.length - 1; i >= 0; i--) { // 从最后一个单词开始输出
System.out.print(words[i] + " ");
}
}
}
```
java中接收用户输入的一句英文,将其中的单词以反序输出。"hello c sharp"→"sharp c hello"
```
import java.util.Scanner;
public class ReverseWords {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Please enter a sentence: ");
String sentence = scanner.nextLine();
String[] words = sentence.split(" ");
for (int i = words.length - 1; i >= 0; i--) {
System.out.print(words[i] + " ");
}
}
}
```