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
Articles by Sunidhi Bansal
Page 10 of 81
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 MorePrint matrix in zag-zag fashion in C Programming.
In C programming, printing a matrix in zig-zag fashion means traversing the matrix diagonally while alternating the direction of traversal. This creates a zig-zag pattern where elements are visited along diagonals, first from top-left to bottom-right, then from bottom-right to top-left, and so on. 10 20 30 40 50 ...
Read MorePrint matrix in snake pattern from the last column in C Programming.
In C, printing a matrix in snake pattern from the last column means traversing the matrix row by row, alternating the direction of column traversal. For odd-numbered rows (index 0, 2, 4...), we print from right to left, and for even-numbered rows (index 1, 3, 5...), we print from left to right. Matrix Snake Pattern from Last Column 10 20 30 40 ...
Read MorePrint matrix in snake pattern in C Programming.
In C programming, printing a matrix in snake pattern means traversing the matrix row by row where even-indexed rows are printed from left to right and odd-indexed rows are printed from right to left. This creates a snake-like zigzag pattern through the matrix elements. ...
Read MorePrint shortest path to print a string on screen in C Program.
Given a string, the program must display the shortest path which will print the string over the screen using that shortest path. The alphabets are arranged on a virtual keyboard in a 5x5 grid format. The keyboard layout is − A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Syntax void printpath(char str[]); Algorithm The approach stores characters in a matrix and calculates the shortest path by − If row difference ...
Read MorePrint sorted distinct elements of array in C language
Given an array of integer elements, the task is to remove duplicate values and print the distinct elements in sorted order. For example, given an array that stores values {4, 6, 5, 3, 4, 5, 2, 8, 7, 0}, we need to identify unique elements and sort them. The final result should be {0, 2, 3, 4, 5, 6, 7, 8}. Original Array: 4 6 ...
Read MorePrint numbers with digits 0 and 1 only such that their sum is N in C Program.
Given an integer n, the task is to print numbers consisting only of digits 0 and 1 whose sum equals n. The valid numbers containing only zeros and ones are: 1, 10, 11, 100, 101, 110, 111, etc. We need to find a combination of these numbers that adds up to n. For example, if n = 31, possible combinations are: 10+10+11 = 31 or 10+10+10+1 = 31. Syntax void findNumbers(int n); Algorithm The algorithm uses a greedy approach − Start with the given number n While n > 0, check ...
Read More