• Viernes 3 de Mayo de 2024, 08:08

Autor Tema:  TABLA DE MULTIPLICAR CON WHILE  (Leído 9146 veces)

elturkodj007

  • Nuevo Miembro
  • *
  • Mensajes: 2
    • Ver Perfil
TABLA DE MULTIPLICAR CON WHILE
« en: Jueves 26 de Agosto de 2010, 05:56 »
0
Hola. soy nuevo en Programacion con C#, por lo que decidi pedir ayuda, en otro foro pude observar un programa en modo consola para poder elaborar las tablas de multiplicar utilizando un for, pero el que me han pedido en mi clase no es con for sino que utilize un while, pero no puedo hacer que funcione, alguien q pueda hecharme una manita, gracias.

breadpett

  • Nuevo Miembro
  • *
  • Mensajes: 7
    • Ver Perfil
Re: TABLA DE MULTIPLICAR CON WHILE
« Respuesta #1 en: Viernes 1 de Octubre de 2010, 05:42 »
0
esta es una forma:

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            int i = 0;
            int b = 0;
           
            while (i <= 1000)
            {
               
                i++;
               
                if ((i % 13) > 0)
                {

                   
                    continue;
                   
                }
                b++;
                Console.WriteLine("13 x" + b + "=" + i);

            }

            Console.ReadLine();


        }
    }
}
TAMBIEN SE ME OCURRIO ESTA FORMA MS SENCILLA:

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

             int a = 0;
             int b = 13;
             int c = 0;
             
              while (a <= 500) {
                  c++;
                  a = a + b;

              Console.WriteLine( "13 x" + c + "=" + a);
             
   
               }

              Console.ReadLine();
             


        }
    }
}
ESPERO TE SIRVA, SALUDOS!

elturkodj007

  • Nuevo Miembro
  • *
  • Mensajes: 2
    • Ver Perfil
Re: TABLA DE MULTIPLICAR CON WHILE
« Respuesta #2 en: Viernes 1 de Octubre de 2010, 14:58 »
0
Muchas gracias!!! bueno espero aprender como tu pero se q se hace con mas practica. DTB.