martes, 26 de marzo de 2013

códigos en consola c#.

Pirámide

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
{
    class Program
    {

        static void Main(string[] args)
        {
            string text = "";
            for (int i = 1; i < 22; i++)
            {
                text = "";
                for (int j = 1; j < i; j++)
                {
                    text += (Convert.ToString(j)+" ");

                }
                Console.WriteLine(text);
                Console.Write("\n");
            }

            Console.ReadKey();
        }
    }
}

y quedaría
 de la siguiente forma;




No hay comentarios.:

Publicar un comentario