Advertisement
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.Text.RegularExpressions;
- using System.Threading.Tasks;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- var lengthInMeters = int.Parse(Console.ReadLine());
- double widthInCm = double.Parse(Console.ReadLine());
- lengthInMeters *= 100;
- double percent = lengthInMeters % widthInCm;
- double result = 0;
- if (widthInCm == 0)
- {
- result = lengthInMeters * widthInCm;
- Console.WriteLine($"{result:F2}");
- }
- else
- {
- if (percent != 0)
- {
- result = (lengthInMeters / widthInCm) * 100;
- Console.WriteLine($"{result:F2}%");
- }
- else
- {
- result = lengthInMeters * widthInCm;
- Console.WriteLine($"{result:F2}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement