foreach (DataGridViewRow item in dataGridView1.Rows){
int sum = item.Index;
dataGridView1.Rows[sum].Cells[2].Value = (Double.Parse(dataGridView1.Rows[sum].Cells[0].Value.ToString()) *
Double.Parse(dataGridView1.Rows[sum].Cells[0].Value.ToString())).ToString();
}