Write a Program to Calculate You have been asked to find the number of Tiles needed for making of a circular pavement along the periphery inside a circular park.
It's given that the radius of the park is R, width of the pavement is P and area of the tiles is 8 square inch. Write a program to enter the values for R and P to display the number of tiles needed for the pavement. [ Attach FOUR sets of outputs taking
FOUR Different sets of values for R and P. ]
Answers
Answered by
1
Explanation:
// Fill the table upto value n
for (int i = 1; i <= n; i++) {
// recurrence relation
if (i > m)
count[i] = count[i - 1] + count[i - m];
// base cases and for i = m = 1
else if (i < m || i == 1)
count[i] = 1;
// i = = m
else
count[i] = 2;
}
// required number of ways
return count[n];
}
// Driver program to test above
int main()
{
int n = 7, m = 4;
cout << "Number of ways = "
<< countWays(n, m);
return 0;
}
Similar questions