Calcula el perimetro de un cuadrado

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

namespace lecturaDeDatos
{
//Nombre : ApPerimetro
//Proposito : Calcula el perimetro de un cuadrado
//Autor : gabriela
//FModificacion : --

class ApPerimetro
{
static void Main(string[] args)
{
//Variables
int Lado;
int Perimetro;


//Indicar que hace el programa


Console.WriteLine("Este programa calcula el perimetro de un cuadrado");

//Leer datos
Console.Write("Ingrese el lado del cuadrado: ");
Lado = int.Parse(Console.ReadLine());

//Procesar – calcular el perimetro del cuadrado
Perimetro = 4 * Lado;


//Mostrar Resultados
Console.WriteLine("El perimetro del cuadrado es {0}",
Perimetro);
Console.ReadLine();
}
}

}
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Registra los datos de una persona

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


namespace registroDeDatos
{
//Nombre : apRegistroDeDatos
//Proposito : Registra los datos de una persona
//Autor : gabriela
//FModificacion : --

class apRegistroDeDatos
{
static void Main(string[] args)
{

//Variables
string Nombre;
string ApPaterno;
string ApMaterno;
int Edad;

//Indicar que hace el programa
Console.WriteLine("PROGRAMA DE REGISTRO DE DATOS \n");

//Leer datos
Console.Write("Ingrese su nombre: ");
Nombre = Console.ReadLine();
Console.Write("Ingrese su apellido paterno: ");
ApPaterno = Console.ReadLine();
Console.Write("Ingrese su apellido materno: ");
ApMaterno = Console.ReadLine();

/* El siguiente par de instrucciones, permite leer un
numero entero por el teclado. Notese que los datos
leidos deben ser explicitamente convertidos */
Console.Write("Ingrese su edad: ");
Edad = int.Parse(Console.ReadLine());

//Mostrar resultados
Console.WriteLine("------------------------------------");
Console.WriteLine(" NOMBRE : {0}",Nombre );
Console.WriteLine(" AP. PATERNO : {0}",ApPaterno );
Console.WriteLine(" AP. MATERNO : {0}",ApMaterno );
Console.WriteLine(" EDAD : {0} años",Edad );
Console.WriteLine("------------------------------------");

Console.ReadLine();

}
}
}
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

calcula el cubo de un numero entero

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

namespace ApCubo
{
class Program
{
static void Main(string[] args)
{
//variables

int numero;
int cubo;
//Indicar que hace el programa


Console.WriteLine("Este programa calcula el cubo de un numero entero");

//Leer datos
Console.Write("Ingrese un numero entero: ");
numero = int.Parse(Console.ReadLine());


//Procesar – calcular el cubo de un numero entero
cubo = numero * numero * numero;



//Mostrar Resultados
Console.WriteLine("El perimetro del cuadrado es {0}",
cubo );
Console.ReadLine();
}
}
}
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

calcula la velocidad de un objeto

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

namespace FisicaMecanica
{
// Nombre : apCalcularVelocidad
// Proposito : calcula la velocidad de un objeto
// Autor : gabriela
// FModificacion : --

class apCalcularVelocidad
{
static void Main(string[] args)
{
// Variables
float distancia;
float tiempo;
float velocidad;

//Indicar que hace el programa
Console.WriteLine("ESTE PROGRAMA CALCULA lA VELOCIDAD DE UN OBJETO DE ACUERDO");
Console.WriteLine("AL ESPACIO QUE RECORRE Y EL TIEMPO DE RECORRIDO");
Console.WriteLine();

// Leer datos
Console.Write("Ingresa la distancia en metros: ");
distancia = float.Parse(Console.ReadLine());
Console.Write("Ingresa el tiempo en segundos: ");
tiempo = float.Parse(Console.ReadLine());

// Procesar
velocidad = distancia / tiempo;

// Mostrar resultados
Console.WriteLine("La velocidad es del objeto es: {0}m/s", velocidad);

Console.ReadLine();

}
}

}
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Calcula el area de un cuadrado

este es un algoritmo para Calcula el area de un cuadrado

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

namespace lecturaDeDatos
{
//Nombre : ApAreaCuadrado
//Proposito : Calcula el area de un cuadrado
//Autor : gabriela
//FModificacion : --

class ApArea
{
static void Main(string[] args)
{
//variables
float lado;
float area;
////Indicar que hace el programa


Console.WriteLine("Este programa calcula el area de un cuadrado");

//Leer datos
Console.Write("Ingrese el lado del cuadrado: ");
lado = float.Parse(Console.ReadLine());

//Procesar – calcular el perimetro del cuadrado
area = lado * lado;


//Mostrar Resultados
Console.WriteLine("El area del cuadrado es {0}", area);
Console.ReadLine();
}
}
}
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

importar imagenes


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace imagenes
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btnSeleccionar_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "seleccionar la imagen";
ofd.Title = "todos(*.*)|*.*|imagenes|*.jpg;*.bmp;*.gif;*.bnp";
if (ofd.ShowDialog() == DialogResult.OK)
{
this.pictureBox1.Image= Image.FromFile(ofd.FileName);
}
}
}
}
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

colores


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace colores
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void rdbAzul_CheckedChanged(object sender, EventArgs e)
{
pictureBox1.BackColor = Color.RoyalBlue;
lbltexto.ForeColor = Color.RoyalBlue;
BackColor = Color.Gray;

}

private void rdbAmarillo_CheckedChanged(object sender, EventArgs e)
{
pictureBox1.BackColor = Color.Yellow;
lbltexto.ForeColor = Color.Yellow;
BackColor = Color.Indigo;
}

private void rdbVerde_CheckedChanged(object sender, EventArgs e)
{
pictureBox1.BackColor = Color.Green;
lbltexto.ForeColor = Color.Green;
BackColor = Color.IndianRed;
}

private void rdbNegro_CheckedChanged(object sender, EventArgs e)
{
pictureBox1.BackColor = Color.Black;
lbltexto.ForeColor = Color.Black;
BackColor = Color.LightGreen;
}

private void rdbRosado_CheckedChanged(object sender, EventArgs e)
{
pictureBox1.BackColor = Color.Pink;
lbltexto.ForeColor = Color.Pink;
BackColor = Color.Gold;
}
}
}
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Buscar en este blog