Bhanu Priya has Published 1449 Articles

C program to interchange the diagonal elements in given matrix

Bhanu Priya

Bhanu Priya

Updated on 01-Sep-2021 13:07:55

1K+ Views

ProblemWe need to write a code to interchange the main diagonal elements with the secondary diagonal elements. The size of the matrix is given at runtime.If the size of matrix m and n values are not equal, then it prints that the given matrix is not a square.Only a square ... Read More

C program to perform operations on two halves’ in a single array

Bhanu Priya

Bhanu Priya

Updated on 01-Sep-2021 13:05:11

829 Views

ProblemWrite a program to accept a one-dimensional array of N elements and split into two halves. Later on, sort the first half in an ascending order and the second half into descending order.SolutionThe solution to perform the two operations on two halves’ in a single array in C programming language ... Read More

C program to find the areas of geometrical figures using switch case

Bhanu Priya

Bhanu Priya

Updated on 01-Sep-2021 13:02:24

7K+ Views

ProblemFind the areas of rectangle, square, triangle, circle by using the switch case statement, User need to enter base, height, side, radius, breadth and length at runtime to calculate the areas of all geometrical figures.SolutionThe solution to find the areas of rectangle, square, triangle, circle by using the switch case ... Read More

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

Bhanu Priya

Bhanu Priya

Updated on 01-Sep-2021 12:56:48

3K+ 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 ... Read More

What are different variations of for loop iterations?

Bhanu Priya

Bhanu Priya

Updated on 01-Sep-2021 12:55:42

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 ... Read More

What is exit() function in C language?

Bhanu Priya

Bhanu Priya

Updated on 01-Sep-2021 12:54:14

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, ... Read More

C program to print four powers of numbers 1 to 9 using nested for loop

Bhanu Priya

Bhanu Priya

Updated on 01-Sep-2021 12:52:49

626 Views

Nested loops consist of one loop placed inside another loop.An example of a nested for loop is as follows −for (initialization; condition; operation){    for (initialization; condition; operation){       statement;    }    statement; }In this example, the inner loop runs through its full range of iterations for ... Read More

What are printf conversion characters and their types?

Bhanu Priya

Bhanu Priya

Updated on 01-Sep-2021 12:48:48

1K+ Views

The use of printf is to print out a string with no blank fields to be filled.For example, printf ("An ordinary string.."); printf ("Testing 1, 2, 3...");The next simplest case that has been used before now is to print out a single integer number.int number = 48; printf ("%d", number);The ... Read More

C program to convert decimal fraction to binary fraction

Bhanu Priya

Bhanu Priya

Updated on 01-Sep-2021 12:46:02

1K+ Views

Consider the examples given below to understand how to convert a decimal fraction to binary fraction in C programming language.Example 1 − Conversions of 25 to binary.Step 1 − 25 / 2 Rem : 1 , Quo : 12Step 2 − 12 / 2 Rem : 0 , Quo : ... Read More

C program to implement Euclid’ s algorithm

Bhanu Priya

Bhanu Priya

Updated on 01-Sep-2021 12:42:54

1K+ Views

ProblemImplement Euclid’ s algorithm to find the greatest common divisor (GCD) and least common multiple (LCM) of two integers and to output the results along with the given integers.SolutionThe solution to implement Euclid’ s algorithm to find the greatest common divisor (GCD) and least common multiple (LCM) of two integers ... Read More

Advertisements