# Untitled

unknown
plain_text
2 years ago
997 B
1
Indexable
Never
```

include <iostream>

#include <cmath>

#define PI 3.14159265

using namespace std;

int main(){

int n;

cout<<"Enter the value of n:"<<endl;

cin>>n;

int theta[3]={20,30,45};

for(int i=0;i<3;i++){

double b,angle,h;

double distance=0;

b=h=0;

if(theta[i]<45){

distance += 10/cos(theta[i]*PI / 180);

b= distance * sin(theta[i] *PI / 180);

b = 10-b;

angle = 90 - theta[i];

}

else{

distance += 10/sin(theta[i]*PI /180);

b= distance * cos(theta[i]* PI /180);

b = 10-b;

angle= theta[i];

}

int num=2;

while(num<=n){

if(angle==45)

distance += 20 *sqrt(2);

else{

h = b / cos(angle*PI /180);

distance += h;

b = distance * sin(angle*PI /180);

b = abs(20-b);

angle = 90 - angle;

}

num++;

}

cout<<distance<<endl;

}

return 0;

}

Note : If you do not get anything in this solution,please put a comment and i will help you out.

Do not give a downvote instantly It is a humble request.

NOTE : PLEASE GIVE ME A LIKE ........... I REALLY NEED THOSE LIKES ..... @! HAPPY CHEGGING
```