Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Numerics;
- namespace ConsoleApplication01
- {
- public class Wormtest
- {
- public static void Main()
- {
- var lengthInM = decimal.Parse(Console.ReadLine());
- var widthInCm = decimal.Parse(Console.ReadLine());
- var lengthInCm = lengthInM * 100M;
- if (widthInCm==0)
- {
- var product = lengthInCm * widthInCm;
- Console.WriteLine($"{product:F2}");
- return;
- }
- var remainder = lengthInCm % widthInCm;
- // Console.WriteLine(lengthInCm +"%" + widthInCm + "=" + remainder);
- if (remainder==0M)
- {
- var product = lengthInCm * widthInCm;
- Console.WriteLine($"{product:F2}");
- }
- else
- {
- var result = lengthInCm / widthInCm;
- var resultInPer = result * 100M;
- Console.WriteLine($"{resultInPer:F2}%");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment