- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1401 Articles for C
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
51 Views
Here we will see the area of biggest Reuleaux triangle inscribed within a square, that square is inscribed inside one right angled triangle. The side of the square is ‘a’. The height of the Reuleaux triangle is x. The base of the triangle is b, height of the triangle is l, and the hypotenuse is h.We know that the side of square inscribed in a Right angled triangle with height l and base b is −The height of the Reuleaux triangle is same as a. So a = x. So the area of Reuleaux triangle is −Example#include #include ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
60 Views
Here we will see the area of biggest Reuleaux triangle inscribed within a square, that square is inscribed inside one ellipse. We know that the major axis length is 2a, and the minor axis length is 2b. The side of the square is ‘x’, and the height of the Reuleaux triangle is h.We know that the side of a square inscribed in an ellipse with major axis 2a and minor axis 2b is −The height of the Reuleaux triangle is same as a. So h = x. So the area of Reuleaux triangle is −.Example#include #include using namespace ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
59 Views
Here we will see the area of biggest Reuleax triangle inscribed within a square which is inscribed in a regular hexagon. Suppose ‘a’ is the side of the hexagon. The side of the square is x and the height of the Reuleaux triangle is h.From the formula of each side of inscribed square inside one hexagon is −𝑥 = 1.268𝑎The height of the Reuleaux triangle is the same as x. So x = h. So the area of the Reuleaux triangle is −Example#include #include using namespace std; float areaReuleaux(float a) { //side of hexagon is a if ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
70 Views
Here we will see the area of biggest Reuleax triangle inscribed within a square which is inscribed in an equilateral triangle. Suppose ‘a’ is the side of the triangle. The side of the square is x and the height of the Reuleaux triangle is h.The side of the triangle is −So the value of x is −𝑥 = 0.464𝑎The height of the Reuleaux triangle is the same as x. So x = h. So the area of the Reuleaux triangle is −Example#include #include using namespace std; float areaReuleaux(float a) { //side of triangle is a if (a ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
62 Views
Here we will see the area of biggest Reuleax triangle inscribed within a square which is inscribed in a semicircle. Suppose the radius of the semicircle is R, are side of the square is ‘a’ and the height of the Reuleax triangle is h.We know that the side of the square inscribed in a semicircle is −The height of the Reuleaux triangle is the same as a. So a = h. So the area of the Reuleaux triangle is −Example#include #include using namespace std; float areaReuleaux(float r) { //radius of the semicircle is r if (r < ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
79 Views
Here we will see one interesting problem. There is a set of N elements. We have to generate an array such that the GCD of any subset of that array lies in the given set of elements. And another constraint is that the generated array should not be more than thrice the length of the set of the GCD. For example, if there are 4 numbers {2, 4, 6, 12}, then one array will be {2, 2, 4, 2, 6, 2, 12}To solve this problem, we have to sort the list at first, then if the GCD is the same ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
79 Views
Here we will see one interesting problem. We will take one array, then find the sum by taking each element after dividing it by the previous elements. Let us consider an array is {5, 6, 7, 2, 1, 4}. Then the result will be 5 + (6 / 5) + (7 / 6) + (2 / 7) + (1 / 2) + (4 / 1) = 12.15238. Let us see the algorithm to get the concept.AlgorithmdivSum(arr, n)begin sum := arr[0] for i := 1 to n-1, do sum := sum + arr[i] / arr[i-1] done return sum endExample#include using namespace std; float divSum(int arr[], int n){ float sum = arr[0]; for(int i = 1; i
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
258 Views
Suppose we have one array. we have to count how many of the elements present in the array prime number of times. So if the array is {1, 2, 2, 0, 1, 5, 2, 5, 0, 0, 1, 1}, then 1 is present 4 times, 2 is present 3 times, 0 is present 3 times, and 5 is present 2 times. So there are three elements {2, 0, 5} that have occurred prime number of times. So the count will be 3.AlgorithmcountPrimeOccurrence(arr, n)Begin count := 0 define map with int type key and int type value for ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
182 Views
Here we will see one problem. We have one array. our task is to find those elements whose frequencies are more than 1. Suppose the elements are {1, 5, 2, 5, 3, 1, 5, 2, 7}. Here 1 has occurred 2 times, 5 has occurred 3 times and 2 has occurred three times, others have occurred only once. So the output will be {1, 5, 2}AlgorithmmoreFreq(arr, n)Begin define map with int type key and int type value for each element e in arr, do increase map.key(arr).value done for each key check whether the ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
304 Views
Here we will see one interesting problem. We are taking one array ‘a’ with N elements. We have to find an element x such that |a[0] - x| + |a[1] - x|+ … + |a[n-1] - x| is minimized. Then we have to find the minimized sum.Let the array is: {1, 3, 9, 6, 3} now the x is 3. So the sum is |1 - 3| + |3 - 3| + |9 - 3| + |6 - 3| + |3 - 3| = 11.To solve this problem, we have to choose the median of the array as x. If ... Read More