martes, 11 de septiembre de 2012

IMPLEMENTAR UN PROGRAMA QUE ME PERMITA INGRESAR UN VALOR NUMERICO POSITIVO DE DOS DIGITOS. DETERMINAR SI EL PRIMER DIGITO ES MULTIPLO DEL SEGUNDO



using System;

namespace DosDigitos
{
    class Program
    {
        public static void Main(string[] args)
        {
            int num'='0;
            num'='IngresoPositivo();
            Multiplo(num);
            Console.ReadKey();
        }
        public static int IngresoPositivo()
        {
            int valor'='0;
             do{
                 Console.Clear();
                 Console.SetCursorPosition(10,4);
                 Console.Write("INGRESE EL VALOR NUMERICO: ");
                 valor'='int.Parse(Console.ReadLine());
             }while(valor'<'0);
            return valor;
        }
        public static int Multiplo(int cant)
        {
            int dig'='0;
            dig'='cant/10;
            cant'='cant%10;
            if(dig % cant' == '0){
                Console.SetCursorPosition(10,6);
                Console.Write("EL PRIMER DIGITO SI ES MULTIPLO DEL SEGUNDO");
            }
            else{
                Console.SetCursorPosition(10,6);
                Console.Write("EL PRIMER DIGITO NO ES MULTIPLO DEL SEGUNDO");
            }
            return cant;
        }
    }
}


Fecha:  11 de Septiembre del 2012


No hay comentarios:

Publicar un comentario