Found 1401 Articles for C

Program to print solid and hollow rhombus patterns in C

suresh kumar
Updated on 13-Jul-2020 11:59:46

413 Views

Program DescriptionPrint the Solid and Hollow Rhombus Patterns as show belowAlgorithmFor Hollow Rhombus −Accept the Number of Rows for Hollow Rhombus from the User Create a Hollow Rhombus containing the same number of Rows specified by the User. Print the first row containing the number of stars same as the number of rows. Print the second row containing the first and last star as show in the output and leave the spaces between first and the last star. Do the same till you reach the last Row. Print the last row containing the number of stars same as the number ... Read More

Program to print right and left arrow patterns in C

suresh kumar
Updated on 09-Jan-2020 07:01:22

516 Views

Program DescriptionPrint the Right and Left arrow PatternsAlgorithmAccept the number of rows to print the Left and Right Arrow Pattern.Print Upper Part of the Arrow with Stars Patterns Print Inverted Right Triangle with Stars Patterns Print Bottom Part of the Arrow with Stars Patterns Print the Right Triangle with Stars PatternsExample/*Program to print the Left and right arrow pattern*/ #include int main() {    int r, c, rows; //Left Arrow Pattern    int r1, c1, rows1; //Right Arrow Pattern    clrscr();    printf("Enter number of rows to print the Left Arrow Pattern: ");    scanf("%d", &rows);    printf("");    printf("The ... Read More

Program to print Reverse Floyd’s triangle in C

suresh kumar
Updated on 13-Jul-2020 12:01:16

399 Views

Program DescriptionFloyd's triangle is a right-angled triangular array of natural numbers, used in computer science education. It is named after Robert Floyd. It is defined by filling the rows of the triangle with consecutive numbers, starting with a 1 in the top left corner1                               15 14 13 12 11 2 3                             10 9 8 7 4 5 6                         6 ... Read More

Program to print pyramid pattern in C

suresh kumar
Updated on 09-Jan-2020 06:49:19

4K+ Views

Program DescriptionA pyramid is a polyhedron formed by connecting a polygonal base and a point, called the apex. Each base edge and apex form a triangle, called a lateral face. It is a conic solid with polygonal base. A pyramid with an n-sided base has n + 1 vertices, n + 1 faces, and 2n edges. All pyramids are self-dual.AlgorithmAccept the number of rows from the user to form pyramid shape Iterate the loop till the number of rows specified by the user: Display 1 star in the first row Increase the number of stars based on the number of ... Read More

Program to print pentatope numbers upto Nth term in C

suresh kumar
Updated on 09-Jan-2020 06:46:55

167 Views

Program DescriptionA pentatope number is a number in the fifth cell of any row of Pascal's triangle starting with the 5-term row 1 4 6 4 1 either from left to right or from right to left.The first few numbers of this kind are1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001, 1365Pentatope numbers belong in the class of figurate numbers, which can be represented as regular, discrete geometric patterns. The formula for the nth pentatopic number is$$\left(\begin{array}{c}n+3\ 4\end{array}\right)=\left(\frac{n(n+1)+(n+2)+(n+3)}{24}\right)=\left(\frac{n^2}{4!}\right)$$AlgorithmAccept the Nth Term from the User to find the Pentotope Numbers.Use the formula$$\left(\begin{array}{c}n+3\ 4\end{array}\right)=\left(\frac{n(n+1)+(n+2)+(n+3)}{24}\right)=\left(\frac{n^2}{4!}\right)$$Example/* Program to print pentatope numbers ... Read More

Program to print numeric pattern in C

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

649 Views

Program DescriptionPrint the numeric pattern by accepting the number of rows from the user.Input: 5 Rows1 6 2 10 7 3 13 11 8 4 15 14 12 9 5AlgorithmPrint the pattern from the end of each Row Complete the last column of each Row Start from the Second Last Column of the second row Repeat till the number of rows specified by the User.Example/*Program to print Numeric Pattern */ #include int main() {    int k, l, m, count=1;    int rows;    clrscr();    printf(" Please enter the number of rows for the Numeric Pattern: ");    scanf("%d",&rows);    for (k = 1; k

Program to print Diamond Pattern in C

suresh kumar
Updated on 09-Jan-2020 06:41:00

1K+ Views

Program DescriptionThe Diamond pattern is a combination of simple pyramid pattern and inverted pyramid pattern.AlgorithmFirst Row: Display 1 Second Row: Display 1,2,3 Third Row: Display 1,2,3,4,5 Fourth Row: Display 1,2,3,4,5,6,7 Fifth Row: Display 1,2,3,4,5,6,7,8,9 Display the same contents from 4th Row till First Row below the fifth Row.Example/* Program to print Diamond Pattern */ #include int main(){    int i,j,k;    clrscr();    printf("");    printf("Diamond Pattern");    printf("");    printf("");    for(i = 1;i

Program to print numbers columns wise in C

suresh kumar
Updated on 09-Jan-2020 06:35:52

2K+ Views

Program DescriptionPrint the natural numbers columns wise as show below1 2 6 3 7 10 4 8 11 13 5 9 12 14 15Algorithmi stands for rows and j stands for columns. 5 stands for making pattern for 5 Rows and Columns Loop for each Row (i) K is initialized to i Loop for each Column (j) Do the Pattern for the current Column (j) Display the Value of K Reinitialize the Value of K = k + 5 - jExample/* Program to print the Natural Numbers in Columns wise */ #include int main(){    int i,j,k;    printf("Printing the Numbers in Columns wise: ");    printf("");    printf("");    for(i=1;i

Program to print number pattern in C

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

1K+ 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

6K+ 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

Advertisements