
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1339 Articles for C

1K+ Views
Given a matrix as mat[row][column], our task is to check whether the given matrix is singular or not through a function and display the result.Singular matrix is a matrix whose determinant is zero and if the determinant is not zero then the matrix is non-singular.So to find whether the matrix is singular or non-singular we need to calculate determinant first. Determinant of a matrix can be calculated as −$$M1[3][3]\:=\:\begin{bmatrix}a & b & c \d & e & f \g & h & i \end{bmatrix}$$|m1| = a(e*i - f*h) - b(d*i - f*g) + c(d*h - e*g)ExampleInput-: mat[3][3]= { 4, 10, ... Read More

528 Views
Given with the value of n as an input and the task is to compute the value of Log n through a function and display it.Logarithm or Log is the inverse function to exponentiation which means to calculate log the raised power must be calculated as a base.IF $$\log_b x\;\:=\: y\:than\:b^{y}=x$$Like $$\log_2 64\;\:=\: 6\:than\:2^{6}=64$$ExampleInput-: Log 20 Output-: 4 Input-: Log 64 Output-: 6AlgorithmStart In function unsigned int log2n(unsigned int num) Step 1-> Return (num > 1) ? 1 + log2n(num / 2) : 0 In function int main() Step 1-> Declare and assign num = 20 Print log2n(num) ... Read More

613 Views
Given with array, L, R, P as an input and the task is to find the ranges between L and R with the product under modulo as output and display itAs given in the figure we have array of elements and L which is a Left value as 2 and R which is the Right value as 2. Now the program must find the products of ranges between them.ExampleInput-: A[] = { 1, 2, 3, 4, 5, 6 } P = 29 L = 2 R = 6 Output-: 24 Input-: A[] = {1, 2, 3, 4, 5, 6}, ... Read More

299 Views
Given with the number and the task is to generate the diamond pattern with the given n different layers and display it.ExampleInput: n = 3Output:Approach used in the below program is as follows −Input the number of rowsAnd in this pattern there are ((2 * n) + 1) rowsNumber of spaces from 0 – n is (2 * (n – i))And the number of spaces from n+1 till end are ((i – n) * 2)AlgorithmStart Step 1-> declare a function to print a pattern void print_pattern(int n) declare variables as int i, j Loop For i = 1 i

3K+ Views
Given with the input as fraction i.e. a/b and c/d where a, b, c and d can be any integer values other than 0 and the task is to add these two fraction to generate their final sum.Fractions are represented by −a / b, where a is known as numerator and b is known as denominator.a and b can have any numeric values but b can have any numeric value other than 0.Sum of two fractions is represented as a / b + c / d, and the rule for adding the two terms is that their denominator must be ... Read More

3K+ Views
Given with the two points coordinates and the task is to find the distance between two points and display the result.In a two dimension plane there are two points let’s say A and B with the respective coordinates as (x1, y1) and (x2, y2) and to calculate the distance between them there is a direct formula which is given below$$\sqrt{\lgroup x2-x1\rgroup^{2}+\lgroup y2-y1\rgroup^{2}}$$Given below is the diagram representing two points and their differences$$\frac{(x_2-x_1)}{(x_1, y_1)\:\:\:\:\:\:(y_2-y_1)\:\:\:\:\:\:(x_2, y_2)}$$Approach used below is as follows −Input the coordinates as x1, x2, y1 and y2Apply the formula to compute the difference between two pointsPrint the distanceAlgorithmStart Step ... Read More

1K+ Views
Given with the 3-D plane and hence three coordinates and the task is to find the distance between the given points and display the result.In a three dimension plane there are three axis that are x-axis with its coordinates as (x1, y1, z1), y-axis with its coordinates as (x2, y2, z2) and z-axis with its coordinates as (x3, y3, z). To calculate the distance between them there is a direct formula which is given below$$\sqrt{\lgroup x2-x1\rgroup^{2}+\lgroup y2-y1\rgroup^{2}+\lgroup z2-z1\rgroup^{2}}$$Given below is the diagram representing three different axis and their coordinatesApproach used below is as follows −Input the coordinates as (x1, y1, ... Read More

28K+ Views
Given with the current date and the birth date of a person and the task is to calculate his current age.ExampleInput-: present date-: 21/9/2019 Birth date-: 25/9/1996 Output-: Present Age Years: 22 Months:11 Days: 26Approach used below is as follows −Input the current date and birth date of a personCheck for the conditionsIf current month is less than the birth month, then we will not consider the current year because this year has not been completed yet and to compute the differences in months by adding 12 to the current month.If the current date is less than the ... Read More

11K+ Views
Given with the weight and height of a person and the task is to find the BMI i.e. body mass index of his body and display it.For calculating the body mass index we require two things −WeightHeightBMI can be calculated using the formula given below −BMI = (mass or weight) / (height*height)Where weight is in kg and height is in metersExampleInput 1-: weight = 60.00 Height = 5.1 Output -: BMI index is : 23.53 Input 2-: weight = 54.00 Height = 5.4 Output -: BMI index is : 9.3Approach used below is as follows −Input weight(kg) and ... Read More

969 Views
Given with temperature ‘n’ in Fahrenheit and the challenge is to convert the given temperature to Celsius and display it.ExampleInput 1-: 132.00 Output -: after converting fahrenheit 132.00 to celsius 55.56 Input 2-: 456.10 Output -: after converting fahrenheit 456.10 to celsius 235.61For converting the temperature from Fahrenheit to Celsius, there is a formula which is given belowT(°C) = (T(°F) - 32) × 5/9Where, T(°C) is temperature in Celsius and T(°F) is temperature in FahrenheitApproach used below is as follows −Input temperature in a float variable let’s say FahrenheitApply the formula to convert the temperature into CelsiusPrint celsiusAlgorithmStart Step 1-> ... Read More