none
Como elevar un numero al cuadrado, sumarlo y sacarle raiz cuadrada

    Question

  • Buenas, estoy empezando a estudiar c # y  tengo que hacer lo siguiente

    Raiz (base^2 + altura^2)

    si alguien me puede ayudar se lo agredezco.

    Sunday, August 22, 2010 2:31 AM

Answers

  • hola

    podrias usar

     

    int base = 10;
    int altura = 15;

    double raiz = Math.Sqrt(Math.Pow(base, 2) + Math.Pow(altura, 2));

     

    saludos


    Leandro Tuttini

    Blog
    Buenos Aires
    Argentina
    • Proposed as answer by Leandro TuttiniMVP Sunday, August 22, 2010 2:52 AM
    • Unproposed as answer by Dunk1947 Sunday, August 22, 2010 3:03 AM
    • Marked as answer by Dunk1947 Sunday, August 22, 2010 3:03 AM
    Sunday, August 22, 2010 2:47 AM
  • hola

    podrias usar

    Txtperimetro.Text = Convert.ToString(Altura + Base + Convert.ToDouble(Txthipotenusa.Text));

     

    o sino hacer

    double hipotenusa = Math.Sqrt(Math.Pow(Base, 2) + Math.Pow(Altura, 2));

    Txthipotenusa.Text = hipotenusa.ToString();

    Txtperimetro.Text = Convert.ToString(Altura + Base + hipotenusa);

     

    saludos


    Leandro Tuttini

    Blog
    Buenos Aires
    Argentina
    • Marked as answer by Dunk1947 Sunday, August 22, 2010 3:51 AM
    Sunday, August 22, 2010 3:26 AM

All replies

  • hola

    podrias usar

     

    int base = 10;
    int altura = 15;

    double raiz = Math.Sqrt(Math.Pow(base, 2) + Math.Pow(altura, 2));

     

    saludos


    Leandro Tuttini

    Blog
    Buenos Aires
    Argentina
    • Proposed as answer by Leandro TuttiniMVP Sunday, August 22, 2010 2:52 AM
    • Unproposed as answer by Dunk1947 Sunday, August 22, 2010 3:03 AM
    • Marked as answer by Dunk1947 Sunday, August 22, 2010 3:03 AM
    Sunday, August 22, 2010 2:47 AM
  • Muchas, gracias ya me funciono.

    saludos desde colombia

    Sunday, August 22, 2010 3:03 AM
  • que pena pero se me genero otra inquietud, como puedo hacer para utilzar el resultado de la operacion anterior para utilizarlo despues, exactamente debo hacer una suma de el resultado de double raiz con otros datos.

     

    int

     

    Base, Altura;

    Base =

    Convert.ToInt16(Txtbase.Text);

    Altura =

    Convert.ToInt16(Txtaltura.Text);

    Txtarea.Text = ((Base * Altura) / 2).ToString();

     

    Txthipotenusa.Text =

    Math.Sqrt(Math.Pow(Base, 2) + Math.Pow(Altura, 2)).ToString();

    Txtperimetro.Text = "aqui debo sumar altura, base y la hipotenusa"

    }

    Sunday, August 22, 2010 3:13 AM
  • hola

    podrias usar

    Txtperimetro.Text = Convert.ToString(Altura + Base + Convert.ToDouble(Txthipotenusa.Text));

     

    o sino hacer

    double hipotenusa = Math.Sqrt(Math.Pow(Base, 2) + Math.Pow(Altura, 2));

    Txthipotenusa.Text = hipotenusa.ToString();

    Txtperimetro.Text = Convert.ToString(Altura + Base + hipotenusa);

     

    saludos


    Leandro Tuttini

    Blog
    Buenos Aires
    Argentina
    • Marked as answer by Dunk1947 Sunday, August 22, 2010 3:51 AM
    Sunday, August 22, 2010 3:26 AM
  • Muchas gracias, He acabado el ejercicio.

    • Proposed as answer by estimado ff Tuesday, March 27, 2012 5:28 PM
    • Unproposed as answer by estimado ff Tuesday, March 27, 2012 5:29 PM
    Sunday, August 22, 2010 3:51 AM
  • necesito un programa k eleve al cuadrado un numero

    en visual studio y en c# porfavor


    • Edited by estimado ff Tuesday, March 27, 2012 5:31 PM
    Tuesday, March 27, 2012 5:30 PM