0% found this document useful (0 votes)
19 views2 pages

Class Program

The document defines a C# program that takes in 3 double values for heights a, b, and c. It contains two methods - one called numeromayor that determines and prints the largest of the 3 height values, and another called suma that calculates and returns the sum of the 3 heights. The Main method prompts the user to input the 3 height values, calls the two methods to get the largest height and total sum, and prints out the results.

Uploaded by

CrissGasparRamos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

Class Program

The document defines a C# program that takes in 3 double values for heights a, b, and c. It contains two methods - one called numeromayor that determines and prints the largest of the 3 height values, and another called suma that calculates and returns the sum of the 3 heights. The Main method prompts the user to input the 3 height values, calls the two methods to get the largest height and total sum, and prints out the results.

Uploaded by

CrissGasparRamos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

class Program

{

static double numeromayor (double a, double b, double c)
{
double nummay;
double a, b, c;

if (a > b)
{
if (a > b)
{
Console.Write("la mayor altura es{0} ",a);
}
else
{
Console.Write("la mayor altura es{0} ", b);
}
}
else
{
if (b > c)
{
Console.Write("la mayor altura es{0} ", b);
}
else
{
Console.Write("la mayor altura es{0} ", c);
}
}
if (a > c)
{
Console.Write("la mayor altura es{0} ", a);
}
else
{
Console.Write("la mayor altura es{0} ", c);
}



return (nummay);
}
static double suma (double a, double b, double c)
{
double suma;
suma = (a+b+c);

return (suma);
}
static void Main()
{
double a, b, c, rpta1, rpta2;
Console.Write("ingrese componente altura 1:");
a = double.Parse(Console.ReadLine());
Console.Write("ingrese componente altura 2:");
b = double.Parse(Console.ReadLine());
Console.Write("ingrese compononte altura 3:");
c = double.Parse(Console.ReadLine());
rpta1 = numay(a, b, c);
Console.WriteLine("el el numero mayor es ={0}", rpta1);
rpta2 = suma(a, b, c);
Console.WriteLine("la suma es ={0}",rpta2);
}
}
}

You might also like