Foros aprenderaprogramar.com

Aprender a programar => C, C++, C#, Java, Visual Basic, HTML, PHP, CSS, Javascript, Ajax, Joomla, MySql y más => Mensaje iniciado por: Gabrield Marquez en 05 de Enero 2016, 00:21

Título: C# ejemplo condicionales if else determinar la sección de estudiante según edad
Publicado por: Gabrield Marquez en 05 de Enero 2016, 00:21
Código del ejemplo:

Código: [Seleccionar]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int edad1 = 0;

            Console.WriteLine("Intruduzca La Edad del Estudiante: ");
            edad1 = Int32.Parse(Console.ReadLine());

            if (edad1 <= 12 == true)
            {
                Console.WriteLine("Este estudiante esta en la seccion 1A");
            } else
                if (edad1 <= 13 == true)
                {
                    Console.WriteLine("Este estudiante esta en la seccion  1B");
                } else
                    if (edad1 >= 14 == true)
                    {
                        Console.WriteLine("Este estudiante esta en la seccion  1C");
                    }
            Console.ReadKey();
        }
    }
}