Found 1401 Articles for C

Program to Calculate the Perimeter of a Decagon in C program

Sunidhi Bansal
Updated on 20-Sep-2019 14:44:39

93 Views

What is Decagon?Given with side, the task is to calculate the perimeter of decagon. Decagon is a type of polygon with 10-sides that’s why it is also known as 10-gon polygon. It have 10 vertices and edges. A regular decagon has sides of equal length and each internal angle of degree 144.Given below is the figure of DecagonTo calculate the volume and surface area of Frustum of cone there is a formulaPerimeter = 10 * SideExampleInput-: side=10 Output-: perimeter of Decagon is : 100 Input -: side = 20 Output -: perimeter of Decagon is : 200AlgorithmStart Step 1 ... Read More

Program to calculate the Area and Perimeter of Incircle of an Equilateral TriangleWhat is Equilateral Triangle in C?

Sunidhi Bansal
Updated on 20-Sep-2019 14:02:44

127 Views

What is Equilateral Triangle?As the name suggests, equilateral triangle is the one that have equal sides and also it have equal interior angles of 60° each. It is also known as regular triangle because it’s a regular polygonProperties of equilateral triangle are −3 sides of equal lengthInterior angles of same degree which is 60IncircleIncircle is the circle that lies inside the triangle which means the center of circle is same as of triangle as shown in the figure below. The center of incircle is known as incenter and radius is known as inradius.Given below is the figure of Incircle of ... Read More

Program to calculate area and perimeter of a rhombus whose diagonals are givenWhat is rhombus in C++?

Sunidhi Bansal
Updated on 20-Sep-2019 12:46:45

171 Views

What is rhombus?In geometry, rhombus is a quadrilateral with four sides of same length. Rhombus resembles with the shape diamond. If the diagonals of rhombus meet at right angle than it becomes square.Properties of rhombus are −equal sidesOpposite sides are parallel and opposite angles are equal making it parallelogramdiagonals bisects at right angleGiven below is the figure of rhombusProblemGiven with the diagonals, let’s say, d1 and d2 the task is to find the area and perimeter of a rhombus where area is the space occupied by the shape and perimeter is the space that its boundaries will coverTo calculate area ... Read More

Program for factorial of a number in C program

Sunidhi Bansal
Updated on 20-Sep-2019 11:53:49

577 Views

Given with the number n the task is to calculate the factorial of a number. Factorial of a number is calculated by multiplying the number with its smallest or equal integer values.Factorial is calculated as −0! = 1 1! = 1 2! = 2X1 = 2 3! = 3X2X1 = 6 4! = 4X3X2X1= 24 5! = 5X4X3X2X1 = 120 . . . N! = n * (n-1) * (n-2) * . . . . . . . . . .*1ExampleInput 1 -: n=5    Output : 120 Input 2 -: n=6    Output : 720There are multiple methods that ... Read More

Program for EMI Calculator in C program

Sunidhi Bansal
Updated on 20-Sep-2019 11:48:47

597 Views

Given with certain values the program will develop an EMI calculator to generate the needed output. EMI stands for Equated Monthly Installment. So this calculator will generate monthly EMI amount for the user.ExampleInput-: principal = 2000    rate = 5    time = 4 Output-: Monthly EMI is= 46.058037The formula used in the below program is −EMI : (P*R*(1+R)T)/(((1+R)T)-1)where, P indicates loan amount or the Principal amount.R indicates interest rate per monthT indicates loan time period in yearApproach used below is as followsInput principal, rate of interest and time in float variableApply the formula to calculate the EMI amountPrint the ... Read More

Program for n’th node from the end of a Linked List in C program

Sunidhi Bansal
Updated on 04-Jul-2020 07:01:13

1K+ Views

Given with n nodes the task is to print the nth node from the end of a linked list. The program must not change the order of nodes in a list instead it should only print the nth node from the last of a linked list.ExampleInput -: 10 20 30 40 50 60    N=3 Output -: 40In the above example, starting from first node the nodes till count-n nodes are traversed i.e 10, 20 30, 40, 50, 60 and so the third node from the last is 40.Instead of traversing the entire list this efficient approach can be followed ... Read More

Product of the nodes of a Singly Linked List

Sunidhi Bansal
Updated on 20-Sep-2019 08:01:06

276 Views

Given with n nodes the task is to print the product of all the nodes of a singly linked list. The program must traverse all the nodes of a singly linked list starting from the initial node till the NULL is not found.ExampleInput -: 1 2 3 4 5 Output -: 120In the above example, starting from first node all the nodes are traversed i.e 1, 2 3, 4, 5, 6 and their product is 1*2*3*4*5*6 = 120Approach used below is as followsTake a temporary pointer, lets say, temp of type nodeSet this temp pointer to first node which is ... Read More

Product of the alternate nodes of linked list

Sunidhi Bansal
Updated on 20-Sep-2019 07:50:04

119 Views

Given with n nodes the task is to print the product of alternate node in a linked list. The program must only print the product of alternate nodes without actually changing the locations of the nodes.ExampleInput -: 10 20 30 40 50 60 Output -: 15000In the above example, starting from first node which is 10 alternate nodes are 10, 30, 50 and their product is 10*30*50 = 15000.In the above diagram, blue coloured nodes are the alternate nodes, if we start from first node and red coloured nodes are non considerable nodes.Approach used below is as followsTake a temporary ... Read More

C Program to find IP Address, Subnet Mask & Default Gateway

sudhir sharma
Updated on 19-Sep-2019 09:09:18

745 Views

C programming language can be used to find the details of the Internet connection of the system. Now, let’s learn about the basics terms that we need in this problem.IP Address − IP Address stands for Internet Protocol address. An IP address is a fixed numerical identification number that is associated with each device. IP address allows communication of your device using IP address over the internet.Subnet Mask − A 32-bit component of the IP address. The subnet mask differentiates the network component of IP address into two parts of the IP address. One being network address and other being ... Read More

C Program to find direction of growth of stack

sudhir sharma
Updated on 19-Sep-2019 09:07:16

419 Views

A stack is a data structure that stores elements. There are two operations on the stack. push that adds a new element to the stack. pop that removes an element from the stack.The stack can grow upward and downward according to the nature of the program that uses it. The program to find the direction of the growth of stack in a program.AlgorithmStep 1: Create a local variable in the main function. Step 2: Create a function that with a local variable. Step 3: Call the function from the main function. And then compare the local variables of in both ... Read More

Advertisements