Taller
Andrés Felipe González Romero
1) Punto:
using System;
namespace _3_proyecto
{
class Program
{
static void Main(string[] args)
{
int g = 0, h = 0;
float t= 0f;
int r= 0;
Console.WriteLine("INGRESE EL NUMERADOR");
g = Int32.Parse(Console.ReadLine());
Console.WriteLine("INGRESE EL DENOMINADOR");
h = Int32.Parse(Console.ReadLine());
t =(float)g / h;
r= g % h;
if (r == 0)
{
Console.WriteLine("la division es exacta");
}
else
{
Console.WriteLine("la division es inexacta");
}
}
}
}
2)Punto:
using System;
namespace _3_proyecto
{
class Program
{
static void Main(string[] args)
{
int g = 0;
Console.WriteLine("INGRESE el numero positivo maximo de dos digitos");
g = Int32.Parse(Console.ReadLine());
if (g > 0 && g < 9)
{
Console.WriteLine("el numero tiene un digito");
}
else if (g >= 10 && g <= 99)
{
Console.WriteLine("el numero tiene 2 digitos");
}
else
{
Console.WriteLine("numero invalido");
}
}
}
}
3)Punto:
using System;
namespace _3_proyecto
{
class Program
{
static void Main(string[] args)
{
int g = 0, h = 0;
Console.WriteLine("INGRESE EL primero numero");
g = Int32.Parse(Console.ReadLine());
Console.WriteLine("INGRESE EL segundo numero");
h = Int32.Parse(Console.ReadLine());
if (g<h)
{
Console.WriteLine(h + "es mayor que" + g);
}
else if (g>h)
{
Console.WriteLine(g + "es mayor que" + h);
}
else
{
Console.WriteLine(g + "es igual que" + h);
}
}
}
}
4)Punto:
using System;
namespace _3_proyecto
{
class Program
{
static void Main(string[] args)
{
String g;
float a = 0, d = 0, b = 0, h = 0;
Console.WriteLine("si desea calcular el area de un triangulo ingrese Tot
y si quiere calcular la de un circulo ingrese C o c");
g = Console.ReadLine();
if (g == "T" || g == "t")
{
Console.WriteLine("ingrese la base");
b = float.Parse(Console.ReadLine());
Console.WriteLine("ingrese la altura");
h = float.Parse(Console.ReadLine());
a = (b * h) / 2;
Console.WriteLine("el area del trianguko es" + a);
}
else if (g == "C" || g == "c")
{
Console.WriteLine("ingrese el radio");
d = Int32.Parse(Console.ReadLine());
a = (float)(3.1415592 * (d * d));
Console.WriteLine("el area del circulo es" + a);
}
else
{
Console.WriteLine("letrainvalida");
}
}
}
}