Advertisement
OneTallor

Untitled

Sep 17th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 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 ConsoleApplication4
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double a = 0;
  14.             double b = 0;
  15.             Console.Write("Kérem a(z) 'A' számot: ");
  16.             a = Convert.ToDouble(Console.ReadLine());
  17.             Console.Write("Kérem a(z) 'B' számot: ");
  18.             b = Convert.ToDouble(Console.ReadLine());
  19.  
  20.             double c = a / b;
  21.             double d = b / a;
  22.  
  23.             if (a < b)
  24.             {
  25.                 if (a == 0)
  26.                 {
  27.                     Console.WriteLine("Nullával nem lehet osztani");
  28.                 }
  29.                 else
  30.                 {
  31.                     Console.WriteLine("'B' osztva 'A'-val: {0:0.00} ", d);
  32.                 }
  33.                
  34.             }
  35.             if (b < a)
  36.             {
  37.                 if (b == 0)
  38.                 {
  39.                     Console.WriteLine("Nullával nem lehet osztani");
  40.                 }
  41.                 else
  42.                 {
  43.                     Console.WriteLine("'A' osztva 'B'-vel: {0:0.00} ", c);
  44.                 }
  45.                
  46.             }
  47.             if (a == 0 && b == 0)
  48.                 Console.WriteLine("Hiba");
  49.  
  50.             Console.ReadLine();
  51.  
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement