Server Side Programming Articles - Page 2233 of 2650

# and ## Operators in C ?

Vivek Verma
Updated on 12-Jul-2025 23:12:11

3K+ Views

In C, the "#" and "##" are the pre-processor operators that are used to convert a macro parameter to a String Literal. The macro parameters are the parameters of the macro definition, which are declared using the #define directive. The "#" operator is known as the Stringize operator, whereas the "##" operator is known as the Token Pasting operator. The #define Directive in C The #define directive is a preprocessor command that is used to create macros in the C programming language. Here is a syntax to create macros: #define MACRO_NAME replacement_text Or #define MACRO_NAME(param1, param2, …paramN) replacement_text ... Read More

attribute((constructor)) and attribute((destructor)) syntaxes in C in tutorials point ?

Arnab Chakraborty
Updated on 30-Jul-2019 22:30:26

3K+ Views

Here we will see how to write a code where two functions are present, and one function will be executed before the main function, and another function will be executed after main function. These features are used to do some startup task before executing main, and some clean up task after executing main.To do this task we have to put attribute for these two functions. When the attribute is constructor attribute, then it will be executed before main(), and when the attribute is destructor type, then it will be executed after main().We are using GCC functions. The function is __attribute__(). ... Read More

C/C++ program to make a simple calculator?

karthikeya Boyini
Updated on 14-Feb-2025 18:07:39

1K+ Views

A simple calculator allows the user to perform basic math operations like addition, subtraction, multiplication, and division . The user inputs two numbers and selects an operation. For example, if the user enters 4 and 3, then selects the "+" operation, the calculator will perform addition and output the result, 7. Similarly, if the user selects "-", the program will perform subtraction (4 - 3 = 1), and so on. In C++, this can be done using conditional statements and basic math operators. In this article, we will show you how to write a simple calculator program in ... Read More

Area of Circumcircle of a Right Angled Triangle?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

1K+ Views

The area of circumcircle of a right-angle triangle when the hypotenuse(H) of the triangle is given is found using the formula πH2/4.This formula is derived using the fact that the circumcircle touches all the corners of the triangle, in this case the maximum length between two points in the hypotheses which passes through the center of the circle. This makes the hypotenuse the diameter of the circle.This is why the area of circle which is πd2/4. (d = 2r) replaces the d by H.ExampleHypotenuse = 8Area of circle = 50.26Example Code Live Demo#include int main(void) {    int H = ... Read More

Area of circle which is inscribed in an equilateral triangle?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

10K+ Views

The area of a circle inscribed inside an equilateral triangle is found using the mathematical formula πa2/12.Lets see how this formula is derived, Formula to find the radius of the inscribed circle = area of the triangle / semi-perimeter of triangle.Area of triangle of side a = (√3)a2/4Semi-perimeter of triangle of side a = 3a/2According to formula, Radius of circle = (√3)a22/4 / 3a/2 = a/2√3Area of circle = πr2 = πa2/12Example Code Live Demo#include int main(void) {    int a = 5;    float pie = 3.14;    float area = (float)((pie*a*a)/12);    printf("the area of circle inscribed in ... Read More

Area of circle inscribed within rhombus?

Sharon Christine
Updated on 30-Jul-2019 22:30:26

3K+ Views

Circle inscribed in a rhombus touches its four side a four ends. The side of rhombus is a tangent to the circle.Here, r is the radius that is to be found using a and, the diagonals whose values are given.Now the area of triangle AOB = ½ * OA * OB = ½ * AB * r (both using formula ½*b*h).½ *a/2*b/2 = ½ *( √ (a2/4 + b2/4))*ra*b/8 = √ (a2+ b2 )*r /4r = a*b/ 2√ (a2+ b2 )Area of circle = π*r*r = π*(a2*b2)/4(a2+ b2 )ExampleThe diagonal of the rhombus 5 & 10.Area is 15.700000Example Code Live Demo#include ... Read More

Area of a Circular Sector?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

1K+ Views

A circular sector also known as circle sector / sector of a circle is the portion of the circle that is inscribed by between 2 radii. This area is enclosed between two radii and an arc. To find the area inscribed we need to find the angle that is between the two radii. The total area is equal to 360o of angle. To find the area for an angle we will multiply the area by θ/360. This given the area of section inscrible.Where θ is the angle between the two radii in degree.Area of a sector of a circle = ... Read More

Area of a circle inscribed in a regular hexagon?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

3K+ Views

The circle inscribed in a regular hexagon has 6 points touching the six sides of the regular hexagon.To find the area of inscribed circle we need to find the radius first. For the regular hexagon the radius is found using the formula, a(√3)/2.Now area of the circle inscribed is 3πa*a/4SampleSide of hexagon − 4Area = 37.68Example Code Live Demo#include int main(void) {    int a = 14;    float pie = 3.14;    float area = (float)(3*a*a*pie/4);    printf("The area of circle inscribed in the hexagon of side %d is %f", a, area);    return 0; }OutputThe area of circle ... Read More

C program to find Decagonal Number?

karthikeya Boyini
Updated on 30-Jun-2020 15:28:18

122 Views

A decagonal number is a figurate that was derived using the concept of triangular numbers and square numbers. This extension of number pattern is created using non-rotationally symmetrical numbers. This nested decagon oriented number is given by the number of dots in the number of nested decagons that are created. For example, for 3rd decagonal number 3 decagonal figures are nest each with iX time the number of sides in the decagon. As shown in figure −Side in 1st Outer figure = 30 Side in 2nd Outer figure = 20 Side in inner figure = 10 Sides common in all = 6+2 Total = 30+20+10-(6+2) ... Read More

Average of even numbers till a given even number?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

3K+ Views

To find the average of even numbers till a given even number, we will add all the even number till the given number and t count the number of even numbers. Then divide the sum by the number of even numbers.ExampleAverage of even numbers till 10 is 6 i.e.2 + 4 + 6 + 8 + 10 = 30 => 30/ 5 = 6There are two methods for calculating the average of even number till n which is an even number.Using LoopsUsing FormulaProgram to find the average of even number till n using loopsTo calculate the average of even numbers ... Read More

Advertisements