elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


  Mostrar Mensajes
Páginas: [1]
1  Programación / Ejercicios / Re: Ejercicios C# en: 18 Abril 2008, 22:39 pm
Esta fue la solucion que encontre del arbolito de navidad


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

namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Escribe un numero");
            string str = Console.ReadLine();
            double f = double.Parse(str);
            if (f > 25)
                f = 25;

            for (int i = 0; i < f; i++)
            {
                Console.CursorTop=i;
                int k = 39-i;
                int l = 40 + i;
                for (int j = k;  j < l;j++  )
                {
                    Console.CursorLeft=j;
                    Console.Write("*");

                }
            }
            Console.Read();
        }
    }
}


y este al de Fibonacci


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

namespace ConsoleApplication12
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Escribe un numero");
            string str = Console.ReadLine();
            double f = double.Parse(str);
            double i = 0, g = 1, h = 0;
            Console.WriteLine(i);
            Console.WriteLine(g);
            for (; h <= f; )
            {
                h = i + g;
                i = g;
                g = h;
                Console.WriteLine(h);

            }
        }
    }
}
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines