-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy path027.cs
37 lines (28 loc) · 837 Bytes
/
027.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
Desafio 027
Problema: Faça um programa que leia o nome completo de uma
pessoa, mostrando em seguida o primeiro e o último
nome separadamente.
Resolução do problema:
*/
using System;
class io {
public static string input(string text) {
Console.Write(text);
return Console.ReadLine();
}
public static void print(object data, string end="\n") {
string text = data.ToString();
Console.Write($"{text}{end}");
}
}
class Program {
public static void Main () {
string nome = io.input("Digite seu nome completo: ");
string[] listaNome = nome.Split(' ');
string primeiroNome = listaNome[0];
string ultimoNome = listaNome[listaNome.Length - 1];
io.print($"Primeiro nome: {primeiroNome}");
io.print($"Ultimo nome: {ultimoNome}");
}
}