COMO HACER PARA SABER EL AREA DE UN TRIANGULO EN C#:
desarrollamos lo siguiente pa desarollar el ejercicio.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ejercicio3
{
class Program
{
static void Main(string[] args)
{int a,b,c;
string a1, b1, c1;
Console.WriteLine("digite la base del triangulo");
a1 = Console.ReadLine();
Console.WriteLine("digite la altura del triangulo");
b1 = Console.ReadLine() ;
a = int.Parse(a1);
b = int.Parse(b1);
c = a * b / 2;
Console.WriteLine("el area del triangulo es"+c);
Console.ReadLine();
}
EN EL SIGUIENTE TALLER DE C# EL USUARIO DICE UN NUMERO Y AUTOMATICAMENTE LE DA TABLA DE MULTIPLICAR HASTA 10:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ejercicio_2
{
class Program
{
static void Main(string[] args)
{
int a, b;
string a1;
Console.WriteLine("digite un numero");
a1 = Console.ReadLine();
a = int.Parse(a1);
b = a * 0;
Console.WriteLine(a + " *0 =" + b);
Console.Read();
b = a * 1;
Console.WriteLine(a + " *1 =" + b);
Console.Read();
b = a * 2;
Console.WriteLine(a + " *2 =" + b);
Console.Read();
b = a * 3;
Console.WriteLine(a + " *3 = " + b);
Console.Read();
b = a * 4;
Console.WriteLine(a + " *4 = " + b);
Console.Read();
b = a * 5;
Console.WriteLine(a + " *5 =" + b);
Console.Read();
b = a * 6;
Console.WriteLine(a + " *6 =" + b);
Console.Read();
b = a * 7;
Console.WriteLine(a + " *7 =" + b);
Console.Read();
b = a * 8;
Console.WriteLine(a + " *8 =" + b);
Console.Read();
b = a * 9;
Console.WriteLine(a + " *9 =" + b);
Console.Read();
b = a * 10;
Console.WriteLine(a + " *10 =" + b);
Console.Read();
}
EN EL SIGUIENTE EJERCICIO DE C# ES PARA SUMAR 3 NUMEROS:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EJERCICIO_1
{
class Program
{
static void Main(string[] args)
{
int a,b,c,d;
string a1,b1,c1;
Console.WriteLine("digite un numero");
a1 =Console.ReadLine();
Console.WriteLine("digite un segundo numero");
b1 = Console.ReadLine();
Console.WriteLine("digite un tercer numero");
c1 = Console.ReadLine();
a = int.Parse(a1);
b = int.Parse(b1);
c = int.Parse(c1);
d = a + b + c;
Console.WriteLine("el resultado es"+d);
Console.Read();
}
jueves, 13 de agosto de 2009
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario