Sunidhi Bansal

Sunidhi Bansal

809 Articles Published

Articles by Sunidhi Bansal

Page 9 of 81

C Program for n-th odd number

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

Given a number N, we have to find the N-th odd number. Odd numbers are the numbers which are not completely divisible by 2 and their remainder is not zero, like 1, 3, 5, 7, 9, etc. If we closely observe the sequence of odd numbers, we can represent them mathematically as − 1st odd number: (2*1)-1 = 1 2nd odd number: (2*2)-1 = 3 3rd odd number: (2*3)-1 = 5 4th odd number: (2*4)-1 = 7 ... Nth odd number: (2*N)-1 So, to solve the problem we can simply multiply the number ...

Read More

C Program for n-th even number

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

Given a number N we have to find the N-th even number. Even numbers are the numbers which are completely divided by 2 and their remainder is zero. Like 2, 4, 6, 8, 10, and so on. If we closely observe the list of even numbers we can also represent them as − 2*1=2, 2*2=4, 2*3=6, 2*4=8, ….2*N. So, to solve the problem we can simply multiply the number N with 2, so the result will be the number which is divisible by 2, i.e. the even number. Syntax nth_even_number = n * ...

Read More

Program to Convert Radian to Degree in C

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

Converting radians to degrees is a common mathematical operation in C programming. A radian is the standard unit for measuring angles in mathematics, while degrees are commonly used in everyday applications. The complete angle of a circle is 360 degrees or 2π radians. Syntax degree = radian × (180 / π) Where π (pi) ≈ 3.14159 or can be approximated as 22/7. Conversion Formula The mathematical relationship between radians and degrees is − degree = radian × (180/π) where, π = 3.14159 For example, if radian = 9.0, then ...

Read More

Program for Identity Matrix in C

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

Given a square matrix M[r][c] where 'r' is some number of rows and 'c' are columns such that r = c, we have to check that 'M' is identity matrix or not. Identity Matrix Identity matrix is also known as Unit matrix of size nxn square matrix where diagonal elements will only have integer value one and non diagonal elements will only have integer value as 0. Like in the given Example below − I₁ = [1] I₂ = ...

Read More

Program to Convert Centimeter to Feet and Inches in C

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

Given with the length in centimeters as an input, the task is to convert the given length into feet and inches using C programming. We can use length conversion formulas for this − 1 feet = 30.48 cm 1 inch = 2.54 cm Syntax double inches = centimeters * 0.3937; double feet = centimeters * 0.0328; Algorithm Start Step 1 → Declare function to perform conversion double convert(int centimeter) set double inch = 0.3937 * centimeter ...

Read More

Program to Calculate the Perimeter of a Decagon in C program

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

A decagon is a polygon with 10 sides and 10 vertices. In a regular decagon, all sides are equal in length and each internal angle measures 144 degrees. The perimeter of any polygon is the sum of all its side lengths. V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 ...

Read More

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 267 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 964 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 254 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
Showing 81–90 of 809 articles
« Prev 1 7 8 9 10 11 81 Next »
Advertisements