Computer Science, asked by sivashankarimoorhy, 1 year ago

An activist of a banned organization,plans to escape from Bhopal jail.Te activaast is basically a monkey man and is able to jnump across the wall.he practises to cross a wall.he is able to jump 'X' meters,but because of the slippery wall he falls 'Y' meters after each jump.To escape from jail, he has to cross 'N' number of walls , where height of eack wwall is given in n array.

Answers

Answered by manishyouth
1
#include<stdio.h>#include<conio.h>int main(){ int jump,slide,f_jump,n_wall,i; int result=0; int n; printf("Enter the number of wall"); scanf("%d",&n_wall); int arr[n_wall]; printf("Enter the size of wall"); for(i=0;i<n_wall;i++) { scanf("%d",&arr[i]); } printf("Enter the capacity of jump"); scanf("%d",&jump); printf("Enter the sliding distance"); scanf("%d",&slide); f_jump=jump-slide; for(i=0;i<n_wall;i++) { if(arr[i]<=jump)
{ result=result+1;  } else if(arr[i]%f_jump==0 && arr[i]>jump) { n= arr[i]/f_jump; result= result+n; } else if(arr[i]%f_jump!=0 && arr[i]>jump) { n= arr[i]/f_jump; result= result+n+1; } } printf("Number of jump to escape the bhopal jail is %d", result);}

Try it.
this is my effort to solve this qn.
if u feel any confusion comment please.
happy to help.
Similar questions