Machine Problem 6.7
Write a program using string functions that will accept the name of the capital as input value and will display the corresponding country.
CAPITALS COUNTRIES
Ottawa Canada
Washington D.C. United States
Moscow Russia
Rome Italy
Manila Philippines
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputeAverageApp
{
class ComputeAverageProgram
{
static void Main(string[] args)
{
Console.Write("Enter the capital: ");
string capital = Console.ReadLine();
string country = "";
if (capital.ToLower() == "Ottawa".ToLower())
country = "Canada";
if (capital.ToLower() == "Washington D.C".ToLower())
country = "United States";
if (capital.ToLower() == "Moscow".ToLower())
country = "Russia";
if (capital.ToLower() == "Rome".ToLower())
country = "Italy";
if (capital.ToLower() == "Manila".ToLower())
country = "Philippines";
Console.WriteLine("Country: " + country);
Console.ReadLine();
}
}
}
Comments
Leave a comment