using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace dms2rad
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double g = double.Parse(textBox1.Text);
double s = dms_rad(g);
label1.Text = s.ToString();
}
private double dms_rad(double g)
{
double a = Math.Abs(g);
double b = Math.Floor(a);
double c = (a - b) * 100;
double d = Math.Floor(c);
double h = d / 60;
double f = (c - d) * 100 / 3600;
double r = b + h + f;
double s = r * Math.PI / 180;
return s;
}
}
}