Found 1339 Articles for C

C/C++ Function Call Puzzle?

sudhir sharma
Updated on 07-Oct-2019 08:14:43

234 Views

This C/C++ function call puzzle is a puzzle that is intended to explore more about the behaviour of method calling in both the programming languages C and C++/.The output of a method in C and C++ is different. Lets see what is the difference in calling methods in C and C++.Let’s take an example and check the output of the below code in c and c++.Example Live Demovoid method() {    // Print statement } int main() {    method();    method(2); }OutputFor C++ −Error : too many arguments to function ‘void method()’For C −Program runs without any error.Logic behind the ... 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

691 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

147 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

127 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

166 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

111 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

140 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 a hexagon in C?

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

133 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