Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 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 _01.Wormtest
  8. {
  9.     class Wormtest
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             decimal wormLengthInMeters = (decimal.Parse(Console.ReadLine())) * 100;
  14.             decimal wormWidthInCentimeters = decimal.Parse(Console.ReadLine());
  15.  
  16.             decimal remainder = wormLengthInMeters % wormWidthInCentimeters;
  17.  
  18.             if (remainder == 0)
  19.             {
  20.                 Console.WriteLine($"{(wormWidthInCentimeters * wormLengthInMeters):f2}");
  21.             }
  22.             else
  23.             {
  24.                 if (wormLengthInMeters % wormWidthInCentimeters == 0 || wormWidthInCentimeters == 0)
  25.                 {
  26.                     decimal product = wormWidthInCentimeters * wormLengthInMeters;
  27.                     Console.WriteLine($"{product:f2}");
  28.                 }
  29.                 decimal presentage = (wormLengthInMeters/wormWidthInCentimeters)*100;
  30.                 Console.WriteLine($"{presentage:f2}%");
  31.             }
  32.  
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement