Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
C Articles
Page 50 of 96
Program to calculate the Area and Perimeter of Incircle of an Equilateral TrianglenWhat is Equilateral Triangle in C?
In C programming, calculating the area and perimeter of an incircle (inscribed circle) of an equilateral triangle involves using specific mathematical formulas. The incircle is the largest circle that can fit inside the triangle, touching all three sides. What is an Equilateral Triangle? An equilateral triangle has three equal sides and three equal interior angles of 60° each. It is also known as a regular triangle because it's a regular polygon. Properties of equilateral triangle are − 3 sides of equal length Interior angles of same degree which is 60° Incircle An ...
Read MoreProgram for EMI Calculator in C program
EMI (Equated Monthly Installment) is a fixed payment amount made by a borrower to a lender at a specified date each month. An EMI calculator helps determine the monthly payment amount based on the loan principal, interest rate, and tenure. Syntax EMI = (P * R * (1 + R)^T) / (((1 + R)^T) - 1) Where: P − Principal loan amount R − Monthly interest rate (annual rate / 12 / 100) T − Total number of months (years * 12) Example: EMI Calculator Implementation The following program calculates the ...
Read MoreProgram for n'th node from the end of a Linked List in C program
In this tutorial, we will learn how to find the nth node from the end of a linked list in C. The program should print the nth node from the last without changing the order of nodes in the linked list. Syntax void findNthFromEnd(struct node* head, int n); Example Input/Output Input − 10 20 30 40 50 60 N = 3 Output − 40 In the above example, the third node from the end is 40. We can visualize this as − ...
Read MoreProduct of the alternate nodes of linked list
Given a linked list with n nodes, the task is to find the product of alternate nodes. The program calculates the product of nodes at positions 1, 3, 5, etc. (starting from position 1) without modifying the linked list structure. Syntax void calculateAlternateProduct(); struct node { int data; struct node *next; }; Example Input: 10 20 30 40 50 60 Output: 15000 In the above example, starting from the first node (10), alternate nodes are 10, 30, 50 and their product is 10 ...
Read MoreC Program to find IP Address, Subnet Mask & Default Gateway
C programming language can be used to find the details of the Internet connection of the system. Now, let's learn about the basic 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. One being network address and other being ...
Read MoreC Program to find direction of growth of stack
A stack is a data structure that stores elements in memory. The stack can grow in two directions: upward (toward higher memory addresses) or downward (toward lower memory addresses). This direction depends on the system architecture and compiler implementation. When functions are called, local variables are allocated on the stack. By comparing the memory addresses of local variables in different function calls, we can determine the stack's growth direction. Syntax void function_name(int *address_pointer); // Compare addresses using pointer arithmetic if (address1 < address2) { /* stack direction logic */ } Algorithm Step ...
Read MoreC program to compare two files and report mismatches
In C programming, we can access files and read their content to perform various operations. Comparing two files character by character helps identify differences between similar documents. This program compares two text files and reports any mismatches found, including the line number and position where the first difference occurs. Syntax FILE *fopen(const char *filename, const char *mode); int getc(FILE *stream); int fclose(FILE *stream); Algorithm Step 1: Open both files with read mode Step 2: Read characters one by one from both files simultaneously Step 3: Compare characters and track line numbers and ...
Read MoreC program that does not suspend when Ctrl+Z is pressed
In C programming, when a program malfunctions or runs indefinitely, programmers can explicitly stop execution using keyboard shortcuts. Understanding how to handle or override these signals is crucial for creating robust applications. There are two primary keyboard shortcuts used to control program execution − Ctrl+C − Sends a SIGINT signal to terminate the program immediately. This signal can be handled using the signal() function in C. Ctrl+Z − Sends a SIGTSTP signal to suspend the program execution. This signal is more powerful and can also be intercepted and handled. Here, we will create a C ...
Read MoreC Program for Reversal algorithm for array rotation
An algorithm is a set of instructions that are performed in order to solve the given problem. Here, we will discuss the reversal algorithm for array rotation and create a program for a reversal algorithm. Now, let's get to some terms that we need to know to solve this problem − Array − A container of elements of the same data type. The size (number of elements) of the array is fixed at the time of the declaration of the array. Array rotation − Rotating an array is changing the order of the elements of the array. ...
Read MoreFind the area of a circle in C programming.
A circle is a closed figure where all points are equidistant from a central point called the center. The distance from the center to any point on the circle is called the radius. To find the area of a circle in C programming, we use the mathematical formula and implement it with proper input handling. Syntax area = π * radius * radius Where π (pi) ≈ 3.14159 and radius is the distance from center to the edge of the circle. Method 1: Using Fixed Radius Value This example calculates the area using ...
Read More