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

Ejercicio de Return

The document contains code for a C# program that defines a UTILS class with a static mayor method. The mayor method takes in two integer parameters, prompts the user to input values for each, compares them and returns the larger value. The Main method calls the mayor method, passing in two integers initialized to 0, and outputs the returned value.

Uploaded by

Oscar Wayne
Copyright
© Attribution Non-Commercial (BY-NC)
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)
36 views2 pages

Ejercicio de Return

The document contains code for a C# program that defines a UTILS class with a static mayor method. The mayor method takes in two integer parameters, prompts the user to input values for each, compares them and returns the larger value. The Main method calls the mayor method, passing in two integers initialized to 0, and outputs the returned value.

Uploaded by

Oscar Wayne
Copyright
© Attribution Non-Commercial (BY-NC)
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
You are on page 1/ 2

using System;

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

namespace ConsoleApplication1
{
class UTILS
{

static int mayor(int a, int b)


{
Console.WriteLine("digite el valor de a");
a = int.Parse(Console.ReadLine());
Console.WriteLine("digite el valor de b");
b = int.Parse(Console.ReadLine());

if (a>b)
{
return a;

if (b>a)
{
return b;

}
static void Main(string[] args)
{
int c;

mayor(c);
Console.WriteLine(c);

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

namespace ConsoleApplication1
{
class UTILS
{

static int mayor(int a, int b)


{
Console.WriteLine("digite el valor de a");
a = int.Parse(Console.ReadLine());
Console.WriteLine("digite el valor de b");
b = int.Parse(Console.ReadLine());

if (a > b)
{
return a;

}
else
{

return b;
}

}
static void Main(string[] args)
{
int c = 0;
int d = 0;

Console.WriteLine(mayor(c,d));

}
}
}

You might also like