documentrr

Download Documentrr

If you can't read please download the document

Upload: jordy-zambrano

Post on 15-Jan-2016

1 views

Category:

Documents


0 download

DESCRIPTION

p.o.o

TRANSCRIPT

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { float x,y; Console.Write("Ingrese un valor: "); x = float.Parse(Console.ReadLine()); Console.Write("Ingrese un valor: "); y = float.Parse(Console.ReadLine()); operaciones nueva = new operaciones(); nueva.llenar(x,y); Console.WriteLine("Suma= {0}", nueva.suma()); Console.WriteLine("Resta= {0}", nueva.resta()); Console.WriteLine("multiplicacion= {0}", nueva.multiplicacion()); if (x == 0 || y == 0) { Console.WriteLine("No se puede dividir para 0"); } else { Console.WriteLine("Division= {0}", nueva.division()); } Console.ReadKey(); } } public class operaciones { public float resultado=0, x=0, y=0; public void llenar(float l, float m) { x = l; y = m; } public float suma() { resultado = x + y; return resultado; } public float resta() { resultado = x - y; return resultado; } public float multiplicacion() { resultado = x * y; return resultado; } public float division() { float k; if (x < y) { k = x; x = y; y = k; } resultado = x / y; return resultado; } }}