Found 26504 Articles for Server Side Programming

Program to print number pattern in C

suresh kumar
Updated on 09-Jan-2020 06:39:18

2K+ Views

Program DescriptionA numerical pattern is a sequence of numbers that have been created based on a rule called a pattern rule. Pattern rules can use one or more mathematical operations to describe the relationship between consecutive numbers in the sequence.Examples for PatternsPattern 11 2 6 3 7 10 4 8 11 13 5 9 12 14 15Pattern 2 1 1 2 3 1 2 3 4 5 1 2 3 4 5 6 7 1 2 3 4 5 6 7 8 9 1 2 ... Read More

Print the Non Square Numbers in C

suresh kumar
Updated on 09-Jan-2020 06:36:43

7K+ Views

Program DescriptionThe square of a number is that number times itself.A square number or perfect square is an integer that is the square of an integer;The perfect squares are the squares of the whole numbers1, 4, 9, 16, 25, 36, 49, 64, 81, 100Here are the square roots of all the perfect squares from 1 to 100.√1 = 1 since 12 = 1 √4 = 2 since 22 = 4 √9 = 3 since 32 = 9 √16 = 4 since 42 = 16 √25 = 5 since 52 = 25 √36 = 6 since 62 = 36 √49 = 7 since 72 = 49 √64 = 8 ... Read More

Print multiplication table of a given number in C

suresh kumar
Updated on 09-Jan-2020 06:26:23

607 Views

Program DescriptionPrint multiplication table of a given numberAlgorithmAccept any number from the User for which we need to form multiplication table.Multiply the given number starting with the value of I (=1)Multiply the given number by incrementing the value of I till the I value is lesser than or equal to 12.Example/* Program to print the multiplication table of a given number */ #include int main() {    int number, i;    clrscr();    printf("Please enter any number to find multiplication table:");    scanf("%d", &number);    printf("Multiplication table for the given number %d: ", number);    printf("");    for(i=1;i

Program to Print Mirrored Hollow Parallelogram in C

suresh kumar
Updated on 09-Jan-2020 06:24:59

672 Views

Program DescriptionIt is a quadrilateral where both pairs of opposite sides are parallel.There are six important properties of parallelograms to knowOpposite sides are congruent (AB = DC).Opposite angels are congruent (D = B).Consecutive angles are supplementary (A + D = 180°).If one angle is right, then all angles are right.The diagonals of a parallelogram bisect each other.Each diagonal of a parallelogram separates it into two congruentAlgorithmAccept number of rows and columns from user. Store it in rows and cols variables.To iterate though rows, run an outer loop with the loop structure should look like for(r=1; r

Print the Mirror Image of Sine-Wave Pattern in C

suresh kumar
Updated on 09-Jan-2020 06:18:30

390 Views

Program DescriptionA sine wave or sinusoid is a mathematical curve that describes a smooth periodic oscillation. A sine wave is a continuous wave. It is named after the function sine, of which it is the graph. It occurs often in pure and applied mathematics, as well as physics,  engineering,  signal processing and many other fields.Print the Mirror Image of Sine-Wave Pattern based on the Wave Height and Wave LengthAlgorithmAccept the Wave Height and Wave LengthPrint the Wave Sign for the Wave Height and the Wave Length.Example/* Program to print the mirror image of Sine Wave*/ #include int main(){    int wave_height;    int wave_length;    int i, j, k;    clrscr(); /*Clears the ... Read More

Program to Print the Squared Matrix in Z form in C

suresh kumar
Updated on 09-Jan-2020 06:15:07

683 Views

Program DescriptionPrint the elements of the squared matrix in Z formA square matrix is a matrix with the same number of rows and columns. An n-by-n matrix is known as a square matrix of order AlgorithmTo print the elements of the Square Matrix in Z form We need to print the first row of matrix then diagonal and then last row of the square matrix.Example/* Program to print a square matrix in Z form */ #include int main(){    int rows, cols, r, c, matrix[10][10];    clrscr(); /*Clears the Screen*/    printf("Please enter the number of rows for the Square matrix: ... Read More

Program to print Lower triangular and Upper triangular matrix of an array in C

suresh kumar
Updated on 13-Jul-2020 11:53:43

13K+ Views

Program DescriptionWrite a program to print lower triangular matrix and upper triangular matrix of an Array.Triangular MatrixA Triangular matrix is one that is either lower triangular or upper triangular.Lower Triangular MatrixA square matrix is called lower triangular if all the entries above the main diagonal are zero.Upper Triangular MatrixA square matrix is called upper triangular if all the entries below the main diagonal are zero.A matrix of the form$${\displaystyle L={\begin{bmatrix}\ell _{1, 1}&&&&0\\ell _{2, 1}&\ell _{2, 2}&&&\\ell _{3, 1}&\ell _{3, 2}&\ddots &&\\vdots &\vdots &\ddots &\ddots &\\ell _{n, 1}&\ell _{n, 2}&\ldots &\ell _{n, n-1}&\ell _{n, n}\end{bmatrix}}}$$is called a lower triangular matrix or left triangular matrix, and analogously a matrix of the form$${\displaystyle U={\begin{bmatrix}u_{1, 1}&u_{1, 2}&u_{1, ... Read More

Pascal's Triangle in C++

AmitDiwan
Updated on 08-Jan-2020 10:15:49

6K+ Views

Pascal’s triangle is an array of binomial coefficients. The top row is numbered as n=0, and in each row are numbered from the left beginning with k = 0. Each number is found by adding two numbers which are residing in the previous row and exactly top of the current cell. It is also being formed by finding (𝑛𝑘) for row number n and column number k.Suppose the input is 10, then the output will be like −               1               1 1             ... Read More

Path Sum in Python

Arnab Chakraborty
Updated on 28-Apr-2020 09:24:19

694 Views

Suppose we have one tree and a sum. We have to find one path such that if we follow that path, we will get the sum that will be matched with the given sum. Suppose the tree is like [0, -3, 9, -10, null, 5] and the sum is 14, then there is a path 0 → 9 → 5To solve this, we will follow these steps.If the root is null, then return Falseif left and right subtree are empty, then return true when sum – root.val = 0, otherwise falsereturn solve(root.left, sum – root.val) or solve(root.right, sum – root.val)Let ... Read More

Convert Sorted Array to Binary Search Tree in Python

Arnab Chakraborty
Updated on 28-Apr-2020 09:18:12

2K+ Views

Suppose we have one sorted array A. We have to generate one height-balanced binary search. In this problem, a height-balanced binary tree is actually a binary tree in which the depth of the two subtrees of every node never differs by more than 1. Suppose the array is like [-10, -3, 0, 5, 9]. So one possible output will be like: [0, -3, 9, -10, null, 5]To solve this, we will follow these steps.If A is empty, then return Nullfind the mid element, and make it rootDivide the array into two sub-arrays, left part of the mid element, and right ... Read More

Advertisements