Bhanu Priya

Bhanu Priya

1,060 Articles Published

Articles by Bhanu Priya

Page 79 of 106

What is C Operator Precedence and Associativity?

Bhanu Priya
Bhanu Priya
Updated on 03-Sep-2021 3K+ Views

First, let us understand what is operator precedence in C programming language.Operator PrecedenceOperator precedence is used to evaluate the order of operators evaluated in an expression. In C programming, every operator has a priority. When there is more than one operator in the given expression, the operator with higher precedence or priority is evaluated first and the operator with the least priority is evaluated later.Operator AssociativityOperator associativity is used to evaluate the order of operators with equal precedence in an expression. In the C programming language, when an expression contains multiple operators with equal or same precedence, we use associativity ...

Read More

What is program development cycle in C language?

Bhanu Priya
Bhanu Priya
Updated on 03-Sep-2021 28K+ Views

When we want to develop a program by using any programming language, we have to follow a sequence of steps. These steps are called phases in program development.The program development life cycle is a set of steps or phases which are used to develop a program in any programming language.Phases of program developmentProgram development life cycle contains 6 phases, which are as follows −Problem Definition.Problem Analysis.Algorithm Development.Coding & Documentation.Testing & Debugging.Maintenance.These six phases are depicted in the diagram given below −Problem DefinitionHere, we define the problem statement and decide the boundaries of the problem.In this phase, we need to understand ...

Read More

C program to store inventory system using structures

Bhanu Priya
Bhanu Priya
Updated on 01-Sep-2021 9K+ Views

Structure is a collection of different datatype variables, grouped together under a single name.Features of structureThe features of structure in the C programming language are as follows −It is possible to copy the contents of all the structure elements of different datatypes to another structure variable of its type by using an assignment operator.For handling the complex datatypes, it is better to create structure within another structure, which is called nested structures.It is possible to pass an entire structure, individual elements of structure and an address of structure to a function.It is possible to create structure pointers.ProgramFollowing is the C ...

Read More

C program to compare if the two matrices are equal or not

Bhanu Priya
Bhanu Priya
Updated on 01-Sep-2021 3K+ Views

The user has to enter the order of two matrices and elements of two matrices. Then, these two matrix are compared.If both matrix elements and size are equal, then it displays that the two matrices are equal.If size of matrix is equal but the elements are not equal, then it displays that the matrix can be compared but is not equal.If the size and elements are not matched, then it displays that the matrices cannot be compared.ProgramFollowing is the C program to compare if the two matrices are equal or not −#include #include main(){    int A[10][10], B[10][10]; ...

Read More

C program to generate the value of x power n using recursive function

Bhanu Priya
Bhanu Priya
Updated on 01-Sep-2021 4K+ Views

ProblemCompute the value of xn , where x and n both are the inputs given by the user at runtimeSolutionThe solution to generate the value of x power n by using the recursive function in C programming language is as follows −The logic to find xn is mentioned below −//Calling function: Xpow=power(x, n); //Called function: if (n==1)    return(x); else if ( n%2 == 0)    return (pow(power(x, n/2), 2)); /*if n is even*/ else    return (x*power(x, n-1));AlgorithmRefer an algorithm given below to generate the value of x power n by using the recursive function.Step 1 − Read long ...

Read More

What are different variations of for loop iterations?

Bhanu Priya
Bhanu Priya
Updated on 01-Sep-2021 2K+ Views

The general form of the for statement is as follows −for (initialization; condition; operation) statement;Initialization is an assignment statement which is used to set the loop control variable.Condition is a relational expression that determines when the loop exits.The operation defines that how the loop variable changes each time when the loop is repeated.In for loops, the conditional test is performed at the top of the loop. This means that the code inside the loop may not be executed when the condition is false.To begin with as in the following example −x = 10; for (y=10; y != x; ++y) printf ...

Read More

What is exit() function in C language?

Bhanu Priya
Bhanu Priya
Updated on 01-Sep-2021 9K+ Views

The exit () function is used to break out of a loop. This function causes an immediate termination of the entire program done by the operation system.The general form of the exit() function is as follows −void exit (int code);The value of the code is returned to the calling process, which is done by an operation system. Generally, zero is used as return code to indicate normal program termination.ExampleFollowing is the C program for use of exit() function −#include void main(){    char ch;    printf("B: Breakfast");    printf("L: Lunch");    printf("D: Dinner");    printf("E: Exit");    printf("Enter your choice:"); ...

Read More

C program to compute the polynomial regression algorithm

Bhanu Priya
Bhanu Priya
Updated on 01-Sep-2021 3K+ Views

Regression is a predictive modelling technique that investigates the relationship between a dependent and non-dependent variable.Polynomial regressionIt is a form of regression analysis that shows the relationship between an independent variable x and the dependent variable y that is modelled a nth degree polynomial in x.ExampleFollowing is the C program to compute the polynomial regression algorithm −#include #include #include main(){    int i,j,k,m,n;    float x[20],y[20],u,a[10],c[20][20],power,r;    printf("enter m,n:");    scanf("%d%d",&m,&n);    for(i=1;i

Read More

C program to compute geometric progression

Bhanu Priya
Bhanu Priya
Updated on 01-Sep-2021 2K+ Views

ProblemWrite a program to read two numbers, x and n, and then compute the sum of the geometric progression.1+x+x2+x3+x4+……….+xnAnd then, print x, n and sum.SolutionThe solution to compute the geometric progression in C programming language is given below −AlgorithmRefer an algorithm to compute the geometric progression.Step 1 − StartStep 2 − RepeatStep 3 − Read values for x and n at runtimeStep 4 − If n > 0 then     Step 4.1: for i = 0 to n do       Step 4.1.1: sum = sum +pow(x, i)       Step 4.1.2: i = i+1     Step 4.2: print x, ...

Read More

C program to convert roman numbers to decimal numbers

Bhanu Priya
Bhanu Priya
Updated on 01-Sep-2021 3K+ Views

Given below is an algorithm to convert roman numbers to decimal numbers in C language −AlgorithmStep 1 − StartStep 2 − Read the roman numeral at runtimeStep 3 − length: = strlen(roman)Step 4 − for i = 0 to length-1 do      Step 4.1 − switch(roman[i])          Step 4.1.1 − case ‘m’:          Step 4.1.2 − case ‘M’:               Step 4.1.2.1 − d[i]: =1000          Step 4.1.3 − case ‘d’:               Step 4.1.4 − case ‘D’:          ...

Read More
Showing 781–790 of 1,060 articles
« Prev 1 77 78 79 80 81 106 Next »
Advertisements