martes, 11 de septiembre de 2012

REALIZAR UN PROGRAMA QUE ME PERMITA INGRESAR 2 CIFRAS Y VERIFICAR SI EL PRIMER NUMERO ES MULTIPLO DEL SEGUNDO


using System;

namespace 2 Cifras
{
    class Program
    {
        public static void Main(string[] args)
        {
           
    int valor=0,n;
    valor=ValidarEntrada();
    Console.SetCursorPosition(15,4);
    n=Buscar(valor);
    if(n==1){
Console.Write("EL PRIMER NUMERO SI ES MULTIPLO DEL SEGUNDO");
}
else{
Console.Write("EL PRIMER NUMERO NO ES MULTIPLO DEL SEGUNDO");
}
Console.ReadKey();
}
public static intValidarEntrada()
{
intcant=0;
do{
Console.Clear();
Console.SetCursorPosition(15,2);
Console.Write("Ingrese Valor de dos digitos: ");
cant = int.Parse(Console.ReadLine());
}
while ((cant<0) || (cant>99));
return cant;
}
  public static int Buscar(intpca)
{
int acum=0,acu=0,res=0;
acum=pca/10;
acu=pca%10;
if((acum%acu)==0)
{
res=1;
}

return res;
}
}

}

No hay comentarios:

Publicar un comentario