Herramientas Informaticas

Capturando y mostrando datos en consola C#

//Programa que captura la fecha de nacimiento , nombre, y muestra la edad actual y el nombre

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Naciemientos
{
    class Program
    {
        static void Main(string[] args)
        {
            string nombre;
            int año_nacimiento;
            int año_actual = 2011;
            int edad;

            //Asignando el nombre
            Console.WriteLine(“Escriba su nombre”);
            nombre = Console.ReadLine();
           
            //Asignando Fecha de nacimento
            Console.WriteLine(“Fecha de nacimiento: “);
            año_nacimiento = Int32.Parse(Console.ReadLine());
           
            //Calculando edad
            edad = año_actual – año_nacimiento;
           
            //Imprimiendo datos
            Console.WriteLine(“nombre”);
            Console.WriteLine(nombre);
            Console.WriteLine(“Año de nacimiento”);
            Console.WriteLine(año_nacimiento);
            Console.WriteLine(“Edad”);
            Console.WriteLine(edad);
            Console.ReadLine();
        }
    }
}

Anterior

Protocolo de investigacion – Taller de investigación I

Siguiente

Programa pida 2 numeros y los sume, reste. divida y multiplique en C#

4 comentarios

  1. asd

    porque al final repetiste la misma linea de edad nombre y año d nacimiento?

  2. julio cesar

    Por que uno es la etiqueta y la otra linea es la variablePor ejemploConsole.WriteLine(“nombre”); Mostrara nombre asi como lo escribiste entre comillasy Console.WriteLine(nombre); mostrara lo que hay en la variable nombre, si te fijas no tiene comillasEs igual con las demasel resultado serianombre julio //o el nombre que le allas puesto

  3. Anonymous

    What's up to all, the contents present at this web page are really amazing for people experience, well, keep up the good work fellows.Also visit my site; http://nutritionistvsdietician.org/how-to-become-a-dietician/

  4. Anonymous

    Please let me know if you're looking for a article writer for your weblog. You have some really good posts and I feel I would be a good asset. If you ever want to take some of the load off, I'd really like to write some articles for your blog in exchange for a link back to mine. Please send me an e-mail if interested.Regards!Visit my blog post; what Is required to Become a nutritionist

Deja un comentario

Creado con WordPress & Tema de Anders Norén

Discover more from Cesar Systems

Subscribe now to keep reading and get access to the full archive.

Continue reading