Sunidhi Bansal

Sunidhi Bansal

809 Articles Published

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?

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 291 Views

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 More

Program for EMI Calculator in C program

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 996 Views

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 More

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

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 2K+ Views

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 More

Product of the alternate nodes of linked list

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 284 Views

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 More

Print matrix in zag-zag fashion in C Programming.

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 1K+ Views

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 More

Print matrix in snake pattern from the last column in C Programming.

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 460 Views

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 More

Print matrix in snake pattern in C Programming.

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 4K+ Views

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 More

Print shortest path to print a string on screen in C Program.

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 379 Views

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 More

Print sorted distinct elements of array in C language

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 635 Views

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 More

Print numbers with digits 0 and 1 only such that their sum is N in C Program.

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 446 Views

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
Showing 91–100 of 809 articles
« Prev 1 8 9 10 11 12 81 Next »
Advertisements