using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Clase03
{
class Program
{
static void Main(string[] args)
{
//Console.Write("Ingrese el primer numero: ");
//int _num1 = Convert.ToInt32(Console.ReadLine());
//Console.Write("Ingrese el segundo numero: ");
//int _num2 = Convert.ToInt32(Console.ReadLine());
//Console.Write("Ingrese las operaciones (+-*/): ");
//string operaciones = Console.ReadLine();
////string x = "guaroa";
////int cantidadCaracteres = x.Length;
//for (int i = 0; i < operaciones.Length; i++)
//{
// string operacionActual = operaciones[i].ToString();
// if (operacionActual == "+")
// {
// Sumar(_num1, _num2);
// }
// if (operacionActual == "-")
// {
// Restar(_num1, _num2);
// }
// if (operacionActual == "*")
// {
// Multiplicar(_num1, _num2);
// }
// if (operacionActual == "/")
// {
// Dividir(_num1, _num2);
// }
//}
//string retornoDelMetodo = missingChar("danilo", 3);
string retorno = Concatenar("guaroa", "mendez");
string retorno2 = Concatenar("cesar", "rodriguez", "leon");
Console.ReadKey();
}
static string Concatenar(string nombre, string apellido)
{
string nombreCompleto = "";
nombreCompleto = nombre;
nombreCompleto = nombreCompleto + " " + apellido;
return nombreCompleto;
}
static void Sumar(int a, int b)
{
int suma = a + b;
Console.WriteLine("La suma es:" + suma.ToString());
}
static void Restar(int a, int b)
{
int resta = a - b;
Console.WriteLine("La resta es:" + resta.ToString());
}
static void Multiplicar(int num1, int num2)
{
int producto = num1 * num2;
Console.WriteLine("El producto es:" + producto.ToString());
}
static void Dividir(int a, int b)
{
if (b == 0)
{
Console.WriteLine("No se puede dividir por cero");
}
else
{
int resultado = a / b;
Console.WriteLine("La division es:" + resultado.ToString());
}
}
static bool Validar()
{
bool retorno = false;
return retorno;
}
static string missingChar(string s, int n)
{
string retorno = "";
for (int i = 0; i < s.Length; i++)
{
//Obviar la posicion que se indica en la variable n
if (i != n)
{
retorno += s[i].ToString();
//Equivalente:
retorno = retorno + s[i].ToString();
}
}
string nombre = "Danilo";
nombre = nombre + " Monegro";
nombre += " Monegro";
return retorno;
}
static string Concatenar(string nombre, string apellido, string segundoapellido)
{
string elnombrecompleto = "";
elnombrecompleto = nombre;
elnombrecompleto = elnombrecompleto + " " + apellido + " " + segundoapellido;
return elnombrecompleto;
}
}
}
No hay comentarios:
Publicar un comentario