Server Side Programming Articles - Page 2159 of 2650

C++ Adam Number

sudhir sharma
Updated on 07-Oct-2019 08:06:37

2K+ Views

Adam Number is a number whose square is reverse of the square of its reverse.Concept Explained − For a number to be adam number, the square of number is reverse of the square of the reverse of the number. Let’s take an example, 12 is the number. Square of 12 is 144 and the reverse of 12 is 21. The square of reverse of 12 i.e. 21 is 441. 441 is the reverse of 144 which is the square of 12.Algorithm to check if a number is adam number −Given the number xy, find the square of the number (xy)2.For ... Read More

C++ program to Adding elements of an array until every element becomes greater than or equal to k

sudhir sharma
Updated on 07-Oct-2019 07:36:17

205 Views

We have array of unsorted element i.e. arr[] and have an integer K, and we have to find the minimum number of steps needed in which the elements of the array will be added to make all the elements greater than or equal to K. We can add two elements of array and make them one.Example, Input: arr[] = {1 10 12 9 2 3}, K = 6 Output: 2ExplanationFirst we can add (1 + 2), so the new array is 3 10 12 9 3, we can add (3 + 3), So the new array is 6 10 12 ... Read More

C program to copy the contents of one file to another file?

sudhir sharma
Updated on 01-Nov-2023 14:17:59

41K+ Views

C Files I/O − Create, Open, Read, Write and Close a File C File management A File can be used to store a large volume of persistent data. Like many other languages 'C' provides the following file management functions, Creation of a file Opening a file Reading a file Writing to a file Closing a file Following are the most important file management functions available in 'C, ' function ... Read More

C program to check if a given string is Keyword or not?

sudhir sharma
Updated on 07-Oct-2019 07:28:38

13K+ Views

Keyword is a predefined or reserved word which is available in C++ library with a fixed meaning and used to perform an internal operation. C++ Language supports more than 64 keywords.Every Keyword exists in lower case letters like auto, break, case, const, continue, int etc.32 Keywords in C++ Language which is also available in the C language.autodoubleintstructbreakelselongswitchcaseenumregistertypedefcharexternreturnunionconstfloatshortunsignedcontinueforsignedvoiddefaultgotosizeofvolatiledoifstaticwhileThese are 30 reserved words that were not in C, but added to C++asmdynamic_castnamespacereinterpret_castboolexplicitnewstatic_castcatchfalseoperatortemplateclassfriendprivatethisconst_castinlinepublicthrowdeletemutableprotectedtruetrytypeidtypenameusingusingusingwchar_tInput: str=”for” Output: for is a keywordExplanationKeywords are reserved words which cannot be used as variable names in program.There are 32 keywords in the C programming language.Compare the string with each ... Read More

Sum of the series 1.2.3 + 2.3.+ … + n(n+1)(n+2) in C

sudhir sharma
Updated on 07-Oct-2019 07:23:56

707 Views

Find the sum up to n terms of the series: 1.2.3 + 2.3.4 + … + n(n+1)(n+2). In this 1.2.3 represent the first term and 2.3.4 represent the second term.Let’s see an example to understand the concept better, Input: n = 5 Output: 420Explanation1.2.3 + 2.3.4 + 3.4.5 + 4.5.6 + 5.6.7 = 6 + 24 + 60 + 120 + 210 = 420nth term = n(n+1)(n+2); where n = 1, 2, 3, …= n(n^2+3n+2)=n^3 +3n^2 +2nNow, noteSum =n(n+1)/2 ; if nth term =n=n(n+1)(2n+1)/6 ; if nth term =n^2=n^2(n+1)^2/4 ; if nth term =n^3Hence the required sum =n^2(n+1)^2 /4 + ... Read More

Biggest Square that can be inscribed within an Equilateral triangle in C?

sudhir sharma
Updated on 07-Oct-2019 07:19:35

155 Views

An inscribed planar shape or solid is one that is enclosed by and "fits snugly" inside another geometric shape or solid. To say that "square is inscribed in triangle" means precisely the same thing as "triangle is circumscribed about square".Biggest Square that can be inscribed within an Equilateral triangle −Biggest Square that can be inscribed within an Equilateral triangle −Let’s take an example, Input: 5 Output: 2.32ExplanationThe side of the square be x.Now, AH is perpendicular to DE.DE is parallel to BC, angle AED = angle ACB = 60In triangle EFC,    ⇒ Sin60 = x/ EC   ⇒ √3 / ... Read More

Biggest Reuleaux Triangle within A Square in C?

sudhir sharma
Updated on 07-Oct-2019 07:14:34

139 Views

A Reuleaux triangle is a shape formed from the intersection of three circular disks, each having its center on the boundary of the other two. Its boundary is a curve of constant width, the simplest and best known such curve other than the circle itself. Constant width means that the separation of every two parallel supporting lines is the same, independent of their orientation. Because all its diameters are the same.The boundary of a Reuleaux triangle is a constant width curve based on an equilateral triangle. All points on a side are equidistant from the opposite vertex.To construct a Reuleaux ... Read More

Biggest Reuleaux Triangle within a Square which is inscribed within a Circle in C?

sudhir sharma
Updated on 07-Oct-2019 07:12:03

171 Views

A Reuleaux triangle is a shape formed from the intersection of three circular disks, each having its center on the boundary of the other two. Its boundary is a curve of constant width, the simplest and best known such curve other than the circle itself. Constant width means that the separation of every two parallel supporting lines is the same, independent of their orientation. Because all its diameters are the same.The boundary of a Reuleaux triangle is a constant width curve based on an equilateral triangle. All points on a side are equidistant from the opposite vertex.To construct a Reuleaux triangleFormula for Reuleaux triangleArea of the Reuleaux ... Read More

Biggest Reuleaux Triangle within a Square which is inscribed within a Right angle Triangle in C?

sudhir sharma
Updated on 07-Oct-2019 07:09:13

116 Views

A Reuleaux triangle is a shape formed from the intersection of three circular disks, each having its center on the boundary of the other two. Its boundary is a curve of constant width, the simplest and best known such curve other than the circle itself. Constant width means that the separation of every two parallel supporting lines is the same, independent of their orientation. Because all its diameters are the same.The boundary of a Reuleaux triangle is a constant width curve based on an equilateral triangle. All points on a side are equidistant from the opposite vertex.To construct a Reuleaux ... Read More

Biggest Reuleaux Triangle inscribed within a square which is inscribed within an ellipse in C?

sudhir sharma
Updated on 07-Oct-2019 07:06:14

150 Views

A Reuleaux triangle is a shape formed from the intersection of three circular disks, each having its center on the boundary of the other two. Its boundary is a curve of constant width, the simplest and best known such curve other than the circle itself. Constant width means that the separation of every two parallel supporting lines is the same, independent of their orientation. Because all its diameters are the same.The boundary of a Reuleaux triangle is a constant width curve based on an equilateral triangle. All points on a side are equidistant from the opposite vertex.To construct a Reuleaux ... Read More

Advertisements