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.Threading.Tasks;
- namespace ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.BackgroundColor = ConsoleColor.DarkCyan;
- Console.ForegroundColor = ConsoleColor.Black;
- Console.Title = "Zadacha 1";
- Console.OutputEncoding = Encoding.UTF8;
- //-------------------------------------
- Console.Clear();
- Console.SetWindowPosition(0, 0);
- //--------------------------------
- Console.WriteLine("Задача: конвертор от USD към BGN. Напишете exit когато приключите.\n");
- Console.Write("USD: ");
- //--------------------------------
- double usd;
- double bgn;
- //--------------------------------
- string message = Console.ReadLine();
- bool IsNumber;
- //--------------------------------
- while (message != "exit"){
- message = Console.ReadLine();
- Console.Write("USD: ");
- // check if theh message is a number
- IsNumber = double.TryParse(message, out usd);
- // it it's a number do the conversion and display
- if (IsNumber){
- bgn = usd * 1.79549;
- string temp = String.Format("{0:0.00}", bgn);
- bgn = Convert.ToDouble(temp);
- Console.WriteLine("{0} щатски долара са {1} лева", usd, bgn);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement