Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 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 cgatito_chicharronera
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Console.WriteLine("resuelve ecueaciones de segundo grado ax^2+bx+c");
  14. Chicharronera ch = new Chicharronera();
  15. Console.WriteLine("ingrese el valor de ax^2");
  16. double a,b,c;
  17. string value = Convert.ToString(Console.ReadLine());
  18. if (Double.TryParse(value, out a))
  19. {
  20. Console.WriteLine("Valor valido");
  21. }
  22. else
  23. {
  24. Console.WriteLine("Por favor ingresar solo numeros");
  25. }
  26. if (a != 0)
  27. {
  28. Console.WriteLine("ingrese el valor de bx");
  29. string value1 = Convert.ToString(Console.ReadLine());
  30. if (Double.TryParse(value1, out b))
  31. {
  32. Console.WriteLine("Valor valido");
  33. }
  34. else
  35. {
  36. Console.WriteLine("Por favor ingresar solo numeros");
  37.  
  38. }
  39. Console.WriteLine("ingrese el valor de c");
  40. string value2 = Convert.ToString(Console.ReadLine());
  41. if (Double.TryParse(value2, out c))
  42. {
  43. Console.WriteLine("Valor valido");
  44. }
  45. else
  46. {
  47. Console.WriteLine("Por favor ingresar solo numeros");
  48. }
  49. ch.Valor1 = a;
  50. ch.Valor2 = b;
  51. ch.Valor3 = c;
  52. if(ch.valchicharronera()==1)
  53. {
  54. Console.WriteLine("tu resultado es: \nx1= " + ch.getchicharronera() + "\nx2= " + ch.getchicharronera2());
  55. }
  56. else
  57. {
  58. Console.WriteLine("Rango de valores no validos");
  59. }
  60. }
  61. else
  62. {
  63. Console.WriteLine("no es una ecuacion de segundo grado");
  64. }
  65. Console.ReadKey();
  66. }
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement