Bhanu Priya

Bhanu Priya

1,060 Articles Published

Articles by Bhanu Priya

Page 91 of 106

C program to convert days into months and number of days

Bhanu Priya
Bhanu Priya
Updated on 26-Mar-2021 13K+ Views

User has to enter total number of days. We need to convert the total number of days into months and left-over days in coming month.The formula to convert days into months is as follows −          Month=days/30The logic to find left-over days for the coming month is as follows −          Days=days %30AlgorithmRefer an algorithm given below to convert days into months and number of days.Step 1: Start Step 2: Declare month and days Step 3: Read total number of days Step 4: Compute months    months=days/30 Step 5: Compute days    Days= days ...

Read More

C program to find in which quadrant the coordinates lie.

Bhanu Priya
Bhanu Priya
Updated on 26-Mar-2021 1K+ Views

ProblemWrite a program to find the quadrant in which the given coordinates lie.User has to enter a coordinate at runtime and we need to find the quadrant in which these coordinates lie.SolutionIf both numbers are positive then, it displays the first quadrant.Example: Input =2, 3 Output = 1st quadrantIf the first number is negative and the second number is positive then, it displays the second quadrant.Example: Input = -4, 3 Output= 2nd quadrantIf the first number is negative and the second number is also negative then, it displays the third quadrant.Example: Input = -5, -7 Output= 3rd quadrantIf the first ...

Read More

Explain the concept of one and two dimensional array processing using C language

Bhanu Priya
Bhanu Priya
Updated on 26-Mar-2021 657 Views

Let us first understand the one dimensional array processing in C programming language.1D Array ProcessingStoring values in 1 D Array(reading) is done as follows −int num[5] int i; for(i=0;i

Read More

C program to remove the brackets from a given input.

Bhanu Priya
Bhanu Priya
Updated on 26-Mar-2021 920 Views

ProblemLet’s create a simplified expression by removing brackets from the expressions.SolutionExample 1Input: A string expression with bracket is as follows: (x+y)+(z+q) The output is as follows: x+y+z+qExample 2The input is as follows: (x-y+z)-p+q The output is as follows: x-y+z-p+qAlgorithmRefer an algorithm to remove the brackets from a given input.Step 1: Declare and read the input at runtime.Step 2: Traverse the string.Step 3: Copy each element of the input string into new string.Step 4: If anyone parenthesis is encountered as an element, replace it with empty space.ExampleFollowing is the C program to remove the brackets from a given input −#include int ...

Read More

C program to sort an array by using merge sort

Bhanu Priya
Bhanu Priya
Updated on 26-Mar-2021 4K+ Views

An array is a group of related data items which share’s a common name. A particular value in an array is identified with the help of its "index number".Declaring arrayThe syntax for declaring an array is as follows −datatype array_name [size];For example, float marks [50]It declares ‘marks’ to be an array containing 50 float elements.int number[10]It declares the ‘number’ as an array to contain a maximum of 10 integer constants.Each element is identified by using an "array index".Accessing array elements is easy by using the array index.The logic we use for merge sort is as follows −void MergeSort(int *array, int ...

Read More

C program to search an array element using Pointers.

Bhanu Priya
Bhanu Priya
Updated on 26-Mar-2021 16K+ Views

ProblemWrite a C program to search an element from an array at runtime by the user and the result to be displayed on the screen after search. If the searching element is not in an array then, we need to search element is not found.SolutionAn array is used to hold the group of common elements under one nameThe array operations are as follows −InsertDeleteSearchAlgorithmRefer an algorithm to search the elements into an array with the help of pointers −Step 1 − Declare and read the number of elements.Step 2 − Declare and read the array size at runtime.Step 3 − ...

Read More

C program to delete an array element using Pointers

Bhanu Priya
Bhanu Priya
Updated on 26-Mar-2021 4K+ Views

ProblemWrite a C program to delete an element from an array at runtime by the user and the result to be displayed on the screen after deletion. If the deleted element is not in an array, then we need to display Invalid Input.SolutionAn array is used to hold the group of common elements under one name.The array operations are as follows −InsertDeleteSearchAlgorithmRefer an algorithm to delete the elements into an array with the help of pointers.Step 1 − Declare and read the number of elements.Step 2 − Declare and read the array size at runtime.Step 3 − Input the array ...

Read More

C Program to insert an array element using pointers.

Bhanu Priya
Bhanu Priya
Updated on 26-Mar-2021 6K+ Views

ProblemWrite a C program to insert the elements into an array at runtime by the user and the result to be displayed on the screen after insertion. If the inserted element is greater than the size of an array, then, we need to display Invalid Input.SolutionAn array is used to hold the group of common elements under one name.The array operations are as follows −InsertDeleteSearchAlgorithmRefer an algorithm to insert the elements into an array with the help of pointers.Step 1: Declare and read the number of elements.Step 2: Declare and read the array size at runtime.Step 3: Input the array ...

Read More

C program to sort an array in descending order

Bhanu Priya
Bhanu Priya
Updated on 26-Mar-2021 17K+ Views

ProblemSort the given array in descending or ascending order based on the code that has been written.SolutionAn array is a group of related data items which share’s a common name. A particular value in an array is identified with the help of its "index number".Declaring arrayThe syntax for declaring an array is as follows −datatype array_name [size];For example, float marks [50]It declares ‘marks’ to be an array containing 50 float elements.int number[10]It declares the ‘number’ as an array to contain a maximum of 10 integer constants.Each element is identified by using an "array index".Accessing array elements is easy by using ...

Read More

C program to find the solution of linear equation

Bhanu Priya
Bhanu Priya
Updated on 26-Mar-2021 5K+ Views

We can apply the software development method to solve the linear equation of one variable in C programming language.RequirementThe equation should be in the form of ax+b=0a and b are inputs, we need to find the value of xAnalysisHere, An input is the a, b values.An output is the x value.AlgorithmRefer an algorithm given below to find solution of linear equation.Step 1. Start Step 2. Read a, b values Step 3. Call function Jump to step 5 Step 4. Print result Step 5: i. if(a == 0)Print value of c cannot be predictedElseCompute c=-b/aReturn cStep 6: StopProgramFollowing is the C ...

Read More
Showing 901–910 of 1,060 articles
« Prev 1 89 90 91 92 93 106 Next »
Advertisements