Programming Articles - Page 2488 of 3366

C Program for Area of a square inscribed in a circle which is inscribed in a hexagon?

sudhir sharma
Updated on 09-Aug-2019 06:57:01

227 Views

Given, A square that is inscribed within a circle that is inscribed in a regular hexagon and we need to find the area of the square, for that we need to find the relation of the side of square and the side of the hexagon.The mathematical formula for the radius of circle inscribed within the hexagon is, r=A√3/2Since, the diagonal of square is equal to diameter of the circle, so the relation between the radius and side is, a=√rBased on the side of hexagon, a = √3A/√2So, Area of the Square, Area=a2 = (√3A/√2)2Example#include #include int main() { ... Read More

Area of a triangle inscribed in a rectangle which is inscribed in an ellipse?

sudhir sharma
Updated on 09-Aug-2019 06:52:46

342 Views

For understanding this complex problem, let's do it in two parts. First we will find the dimensions of the rectangle and based on that we can find the area of a triangle inscribed in it.Using the equation of ellipse and differential calculus, mathematical formula for the area of a rectangle is,  area = 2ab, where 2a = major axis and 2b = minor axis.The largest triangle that can be inscribed in the rectangle, should stand on the same base & has height raising between the same parallel sides of the rectangle.The area of largest triangle inscribed within the rectangle is ... Read More

Area of decagon inscribed within the circle in C Program?

sudhir sharma
Updated on 09-Aug-2019 06:43:58

305 Views

A regular decagon is a ten sided polygon with all sides and angles equal. And here we need to find the area of a decagon that is inscribed inside a circle using the radius of the circle r, Mathematical formula for the side of the decagon inscribed in the circle, a = r√(2-2cos36o)(Using cosine rules)Formula for finding area of decagon, Area = 5*a2*(√5+2√5)/2 Area = 5 *(r√(2-2cos36))^2*(√5+2√5)/2 Area = (5r2*(3-√5)*(√5+2√5))/4Using this formula in a program, Example#include #include int main() {    float r = 8;    float area = (5 * pow(r, 2) * (3 - sqrt(5))* (sqrt(5) ... Read More

Area of hexagon with given diagonal length in C Program?

sudhir sharma
Updated on 09-Aug-2019 06:40:03

1K+ Views

A Hexagon is a closed figure of 6 side and a regular hexagon is the one which has all six sides equal and angle equal. For finding the area of hexagon, we are given only the length of its diagonal i.e d.The interior angles of Hexagon are of 120 degrees each and the sum of all angles of a Hexagon is 720 degrees.The formula to find the area of hexagon with side length a, Area = (3a2 √3) / 2.Since all sides are of same size and angle is 120 degrees, d = 2a or a = d/2By putting the ... Read More

Area of largest Circle inscribed in N-sided Regular polygon in C Program?

sudhir sharma
Updated on 09-Aug-2019 06:34:34

214 Views

An n-sided regular polygon inscribed in a circle, the radius of this circle is given by the formula, r = a/(2*tan(180/n))Suppose a polygon have 6 faces i.e., a hexagon and as we know mathematically that the angle is 30 degreeSo the radius of circle will be (a / (2*tan(30)))Therefore, r = a√3/2We see the polygon can be divided into N equal triangles. Looking into one of the triangles, we see that the whole angle at the center can be divided into = 360/NSo, angle x = 180/n Now, tan(x) = (a / 2) * r So, r = a / ... Read More

Area of Incircle of a Right Angled Triangle in C Program?

sudhir sharma
Updated on 09-Aug-2019 06:28:56

2K+ Views

To find the area of a circle inside a right angled triangle, we have the formula to find the radius of the right angled triangle, r = ( P + B – H ) / 2.Given the P, B and H are the perpendicular, base and hypotenuse respectively of a right angled triangle.Area of a circle is given by the formula, Area = π*r2where π = 22 / 7 or 3.14 and r is the radius of the circle.Hence the area of the incircle will be given by the formula, Area = π* ((P + B – H) / 2)2.Example#include ... Read More

How to find the unicode category for a given character in Java?

Vivek Verma
Updated on 14-May-2025 14:12:22

5K+ Views

A Character class is a subclass of the class named Object, and it wraps a value of the primitive type char. An object of type Character contains a single field whose type is char. Unicode Category of a Character In Java, the Unicode category of a character refers to the classification of characters based on their general type or usage, such as letters, digits, punctuation, symbols, etc. The java.lang.Character class provides methods to find the category of a character according to the Unicode standard. Unicode Category of a Character using getType() One of the basic ways to find the Unicode ... Read More

How to print a formatted text using printf() method in Java?

Vivek Verma
Updated on 29-May-2025 19:07:30

607 Views

In Java, formatted text refers to those text that has been processed and arranged according to a specific format. According to the article, we will use the printf() method to learn how to print the formatted text. Formatted Text using printf() Method In Java, to print the formatted output or text we have a printf() method. The printf() method allows us to format output to a java.io.PrintStream or java.io.PrintWriter. These classes also contain a method called format() which can produce the same results, so whatever we read here for the printf() method can also be applied to the format() method. ... Read More

How to find the number of days in a month of a particular year in Java?

Vivek Verma
Updated on 29-May-2025 18:58:51

2K+ Views

The given task is to find the number of days in a month of a particular year. To understand this, consider that if we can determine the maximum day value in a month, we can use that as the number of days in that month. To do this, we can use the GregorianCalendar class. It is a concrete subclass of the Calendar class, and it provides the standard calendar system used by most of the world. In Java, this GregorianCalendar can handle both the Gregorian calendar as well as Julian calendar. Following are the different ways to ... Read More

Print the string after the specified character has occurred given no. of times in C Program

Sunidhi Bansal
Updated on 08-Aug-2019 10:18:04

764 Views

Task is to print the given after the specified character occurrence for given number of times which is specified by the userInput : string = {“I am harsh vaid “}    Char =’a’    Count =2 Output : rsh vaidIt means user specified character ‘a’ and its occurrence 2 so the output string should be displayed after two occurrences of a.AlgorithmSTART Step 1 -> input character in ch(e.g. ‘a’) and count(e.g. 2) as int Step 2 -> declare and initialize n with size of a string by sizeof(string)/sizeof(string[0]) Step 3 - > Loop For i to 0 and i 0 ... Read More

Advertisements