Bhanu Priya

Bhanu Priya

1,061 Articles Published

Articles by Bhanu Priya

Page 41 of 107

C program to find the solution of linear equation

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 5K+ Views

We can apply the software development method to solve the linear equation of one variable in C programming language. A linear equation of the form ax + b = 0 can be solved by rearranging to find x = -b/a (provided a ≠ 0). Syntax float solve(float a, float b); x = -b / a; // where a != 0 Requirements The equation should be in the form of ax + b = 0 a and b are inputs, we need to find the value of x Handle the case where a ...

Read More

C program to replace all zeros with one in a given integer.

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 4K+ Views

In C programming, replacing all zeros with ones in an integer requires digit-by-digit processing. This can be achieved using recursion or iterative approaches to extract, modify, and reconstruct the number. Syntax int replaceZeros(long int number); Algorithm Follow these steps to replace all zeros with ones in an integer − Step 1 − Input the integer from the user Step 2 − Traverse the integer digit by digit Step 3 − If a zero is encountered, replace it with one Step 4 − Reconstruct and return the modified number Method 1: ...

Read More

C program to compare the structure variables

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 9K+ Views

In C programming language, a structure is a collection of different datatype variables, which are grouped together under a single name. While C doesn't provide a built-in operator to compare entire structures directly, we can compare structure variables by comparing their individual members. Syntax struct tagname { datatype member1; datatype member2; datatype membern; }; Structure Declaration and Initialization The general form of a structure declaration is as follows − struct tagname { datatype member1; ...

Read More

Explain queue by using linked list in C language

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 1K+ Views

A queue is a linear data structure that follows the First In First Out (FIFO) principle. When implemented using linked lists, we can avoid queue overflow and underflow issues that occur with array-based implementations. The linked list provides dynamic memory allocation, allowing the queue to grow or shrink as needed. Operations carried out on a queue using linked lists in C programming language are as follows − Enqueue − Insert an element at the rear Dequeue − Remove an element from the front Display − Show all elements in the queue Front − Get the front element ...

Read More

Explain the stack by using linked list in C language

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 3K+ Views

A stack is a linear data structure that follows the Last-In-First-Out (LIFO) principle. When implementing a stack using a linked list in C, we can avoid stack overflow and underflow issues by dynamically allocating memory. This approach provides flexibility in memory usage and can grow or shrink based on requirements. Syntax struct node { int data; struct node *next; } *top; void push(int value); void pop(); int peek(); int isEmpty(); Stack Operations The primary operations performed on a stack using linked list are − ...

Read More

Explain the deletion of element in linked list

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 907 Views

Linked lists use dynamic memory allocation which allows them to grow and shrink during runtime. A linked list is a collection of nodes where each node contains two parts: data (stores the value) and link (points to the next node). Data Link Data Link Data Link NULL ...

Read More

C program to calculate the standard deviation

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 6K+ Views

Standard deviation is used to measure deviation of data from its mean. The mathematical formula to calculate the standard deviation is as follows − $$s=\sqrt{Variance}$$ where Variance$$=\frac{1}{n}\:\:\displaystyle\sum\limits_{i=1}^n (x_{i}-m)^{2}$$ and $$m=mean=\frac{1}{n}\:\displaystyle\sum\limits_{i=1}^n x_{i}$$ Syntax #include double sqrt(double x); Algorithm Refer an algorithm given below to calculate the standard deviation for the given numbers − Step 1 − Read n items. Step 2 − Calculate sum and mean of the items. Step 3 − Calculate variance. Step 4 − Calculate standard deviation. The logic used in the ...

Read More

C Program to represent a multiplication table.

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 968 Views

In C programming, a multiplication table displays the products of numbers in a systematic grid format. This program creates a 12x10 multiplication table where each row represents multiples of a number from 1 to 12. Syntax for(int i = 1; i

Read More

C program to calculate range of values and an average cost of a personal system.

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 823 Views

A personal system is sold at different costs by vendors. To analyze the pricing data, we need to calculate statistical measures like the average cost and range of values. Let's take the list of costs (in hundreds) quoted by some vendors − 25.00, 30.50, 15.00, 28.25, 58.15, 37.00, 16.65, 42.00, 68.45, 53.50 Syntax Range = Highest Value - Lowest Value Average = Sum of All Values / Total Count Solution The range is the difference between the highest and lowest values in a dataset. The average is the sum of all values divided ...

Read More

C Program to calculate the salesmen salary with macro functions.

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 2K+ Views

In C programming, macro functions provide a way to define constants and simple calculations that are processed during compilation. This program demonstrates how to calculate a salesman's salary using predefined macro constants for base salary, bonus rates, and commission percentages. Problem Statement A laptop manufacturing company has the following monthly compensation policy for their salespersons − Minimum base salary: 3000.00 Bonus for every laptop sold: 200.00 Commission on total monthly sales: 5 percent Since laptop prices change monthly, the sales price of each laptop is fixed at the beginning of every month. Syntax ...

Read More
Showing 401–410 of 1,061 articles
« Prev 1 39 40 41 42 43 107 Next »
Advertisements