NameL3ss

mi primer app en C#

Aug 13th, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace TareaConsola01
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Console.WriteLine("*****Mi primer Programa en C#*****"); //mostrar mensaje
  14.  
  15. CapturarNombre(); ///llama al metodo CapturarNombre
  16.  
  17. ImprimirCiclo(); //metodo que inicia ciclo iterativo
  18.  
  19. Console.Write("El resultado es "+DevolverSuma()+"\n"); //funcion que devuelve el resultado de la suma
  20.  
  21. Console.Write("\n*****Fin de la Aplicacion*****\n"); //Cierre de la aplicacion
  22.  
  23. Console.ReadKey();
  24.  
  25. }
  26.  
  27. /// <summary>
  28. /// Captura un dato de tipo string
  29. /// </summary>
  30. public static void CapturarNombre()
  31. {
  32. Console.Write("\nIngrese su nombre: \n");
  33. string nombre = Console.ReadLine();
  34.  
  35. Console.WriteLine("Tu nombre es: " + nombre);
  36.  
  37. Console.ReadKey();
  38. }
  39.  
  40.  
  41. /// <summary>
  42. /// Inicia un ciclo iterativo
  43. /// </summary>
  44. public static void ImprimirCiclo(){
  45.  
  46. Console.Write("\n*****Ciclo Iterativo*****\n");
  47.  
  48. int i = 0;
  49. for (i = 0; i < 10; i++)
  50. {
  51.  
  52. {
  53. Console.WriteLine("\tnumero " + (i + 1));
  54.  
  55. }
  56.  
  57. }
  58. Console.Write("*****Fin Ciclo Iterativo*****\n");
  59.  
  60. Console.ReadKey();
  61. }
  62.  
  63. /// <summary>
  64. /// funcion que suma dos enteros
  65. /// </summary>
  66. /// <returns></returns>
  67. public static int DevolverSuma()
  68. {
  69. Console.Write("\n*****Suma de dos numeros*****\n");
  70.  
  71. Console.Write("\ningrese un numero: \n");
  72. int numero1 = int.Parse(Console.ReadLine());
  73.  
  74. Console.Write("ingrese otro numero: \n");
  75. int numero2 = int.Parse(Console.ReadLine());
  76.  
  77. return numero1 + numero2;
  78.  
  79. }
  80.  
  81. }
  82.  
  83. }
Advertisement
Add Comment
Please, Sign In to add comment