Last active
August 24, 2020 16:15
-
-
Save mugan86/3da8e23efaf35f2fd1d62a031fde2dc2 to your computer and use it in GitHub Desktop.
Manejar mensajes por consola - Ejercicios
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/** | |
En este ejercicio, vamos a trabajar con el manejo de mensajes por pantalla e introducción de información por teclado. | |
Tenemos que realizar lo siguiente: | |
Introducir por teclado el nombre, apellidos, edad y una afición y almacenarlo.. | |
Mostrarlo siguiendo el siguiente formato | |
========INFORMACIÓN BÁSICA========= | |
Eres <nombre> <apellidos>. | |
Tienes <años> años. | |
Hobby: <hobby>. | |
==================================== | |
*/ | |
namespace EjercicioPractico | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Pedir los datos | |
Console.WriteLine("Nombre:"); | |
string name = Console.ReadLine(); | |
Console.WriteLine("Apellidos:"); | |
string lastname = Console.ReadLine(); | |
Console.WriteLine("Edad:"); | |
string age = Console.ReadLine(); | |
Console.WriteLine("Afición:"); | |
string hobby = Console.ReadLine(); | |
Console.WriteLine("=====INFORMACIÓN BÁSICA====="); | |
Console.WriteLine($"Eres {name} {lastname}"); | |
Console.WriteLine($"Tienes {age} años"); | |
Console.WriteLine($"Hobby: {hobby}"); | |
Console.WriteLine("============================"); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace MensajesPantalla | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Write | |
Console.Write("En la misma línea "); | |
Console.Write("2-En la misma línea"); | |
// WriteLine | |
const string name = "Anartz"; | |
const string lastname = "Mugika"; | |
Console.WriteLine(""); | |
Console.WriteLine(name + " " + lastname); | |
Console.WriteLine($"{name} {lastname} Ledo"); | |
//Readline | |
Console.WriteLine("Introduzca un número: "); | |
string value = Console.ReadLine(); | |
Console.WriteLine($"El número introducido es {value}"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment