(The program below should calculate sine of an angle without using c math library.The angle should be in radian otherwise the program will convert it to radian.The program gives me the wrong output which probably means that it has some logic errors.I think the problem could be with the formula i used or maybe the way i called the functions in the main.I tried hard to locate and solve them but i could not manage to do so.So please help me.Thanks in advance.

```
#include<iostream>
#include<cmath>
using namespace std;
double sum();
void for_r();
void for_d();
int main()
{
double sum, t, x, PI;
int n =1, i = 1;
char choice;
cout<<"Please enter an angle value => ";
cin>>x;
cout<<"Is the angle value in Degree or Radian?"<<endl;
cout<<"Type D if its in degree "<<endl;
cout<<"Type R if its in radian "<<endl;
cin>>choice;
switch(choice){
case 'R':
for_r();
break;
case 'r':
for_r();
break;
case 'D':
for_d();
break;
case 'd':
for_d();
break;
default:
cout<<"Wrong input.Try again!"<<endl;
}
cout<<"MySin(x) = "<<sum<<endl;
return 0;
}
void for_r()
{
int n = 3, i = 1;
double sum, x;
for(n = 1; n > 1; n++)
sum = n-2*(-1) * pow(x,2)/ (n * (n-1));
n = n + 2;
}
void for_d()
{
int n = 3, i = 1;
double sum, x, R, PI;
R = (x * (PI/180));
for(n = 1; n > 1; n++)
sum = n-2*(-1) * pow(R,2)/ (n * (n-1));
n = n + 2;
}
double sum()
{
double sum, x, R, PI;
int n = 3;
sum = (n-2*(-1) * (pow(x,2)/ (n-1)));
return (sum);
}
```