0% encontró este documento útil (0 votos)
71 vistas3 páginas

Programación Básica en C#

The document contains code for 3 programs: 1. A program to calculate the area of a triangle by getting base and height values from the user and performing the area formula calculation. 2. A program to sum the values of two 5-element integer arrays by getting user input for both arrays and adding the corresponding elements together. 3. A program to determine the minimum and maximum values in a data set by getting numeric user input in a do-while loop, tracking the running min and max, and outputting the results.
Derechos de autor
© Attribution Non-Commercial (BY-NC)
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como DOCX, PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
71 vistas3 páginas

Programación Básica en C#

The document contains code for 3 programs: 1. A program to calculate the area of a triangle by getting base and height values from the user and performing the area formula calculation. 2. A program to sum the values of two 5-element integer arrays by getting user input for both arrays and adding the corresponding elements together. 3. A program to determine the minimum and maximum values in a data set by getting numeric user input in a do-while loop, tracking the running min and max, and outputting the results.
Derechos de autor
© Attribution Non-Commercial (BY-NC)
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como DOCX, PDF, TXT o lee en línea desde Scribd

using using using using

System; [Link]; [Link]; [Link];

namespace AreaDeUntriang { class Areatriang { static void Main(string[] args) { double b, h;//declaro mis variables [Link]("ingresar base");//pido la base b = [Link]([Link]());//haGO LA CONVENSION CON UN DOUBLE PARA [Link]("ingrese altura");//aqui en este momento pido la base h = [Link]([Link]());//aqui hago la conversion utilizando un DOUBLE double area;// DECLARO UNA VARIABLE AREA DODNDE SE GUARDARA MI RESULTADO area = (b * h) / 2; ;//EN ESTE MOMMENTO SE LLAMAN ALA VARIA BLE PARA REALIZAR LA OPERACION. [Link](area);// SE LLAMA ALA VARIALE AREA DONDE SE GUARDARA EL MRESULTADO [Link](); //CON UN [Link] SE LEEE EL RESULATDO.

} } }

using using using using using

System; [Link]; [Link]; [Link]; [Link];

namespace SumaDEArreglos1 { class Program { static void Main(string[] args) { int[] numero1 = new int[5]; int[] numero = new int[5];/* Un array de 5 nmeros enteros */ int suma; /* Un entero que ser la suma */ int i; /* Para recorrer los elementos */ int j; for (i = 0; i <= 4; i++) /* Pedimos los datos */ { [Link]("Introduce el dato numero {0}: ", i + 1); numero[i] = Convert.ToInt32([Link]()); } for (j = 0; j <= 4; j++) /* Pedimos los datos */ { [Link]("Introduce el dato numero {0}: ", j + 1); numero[j] = Convert.ToInt32([Link]()); }

suma = 0; /* Valor inicial de la suma */ for (i = 0; i <= 4; i++)/* Y hallamos la suma repetitiva */ for (j = 0; j <= 4; j++) suma += numero[i]+numero1[j]; [Link]("Su suma es {0}", suma);

} } }

using using using using using

System; [Link]; [Link]; [Link]; [Link];

namespace Min_maxi { class Program { static void Main(string[] args) { double x, num, minimo = 1, maximo = 1,media, a = 0; x = 0; //declaramos las variables [Link]("determinar el numero minimo y maximo:\n");//pedimos lo que se va hacer para demnar dicha opreacion do //con un do while evaluamos la condicion que se ejecutara para encontrar el mini y mxim { [Link]("entre que numeros se encuentra");//aqui se pide l opcion de se evALUARA num=[Link] ([Link]()); //AQUI LEEMOS Y CON UN [Link] SE LEERA a+=num; x++; if(maximo<num)maximo=num; if(minimo>num)minimo=num; } while(num<10); // media=a/x; [Link]("el valor maximo es{0},elvalor minimo es {1} ",maximo,minimo); [Link] (); } } }

También podría gustarte