C Programs 55 Lessons

Reverse a String in C

Reversing a string means the string that will be given by the user to your program in a specific sequence will get entirely reversed when the reverse of a string algorithm gets implemented in that particular input string. In the below-mentioned example, two approaches have been used to reverse a string in C language.

    C Program to Print Pascal Triangle

    This C program is used to print a pascal triangle. Example: #include<stdio.h> long factorial(int); int main() { int i, n, c; printf("How many rows you want to show in pascal triangle?\n"); scanf("%d",&n); for ( i = 0 ; i < […]

      C Program to Create Floyd's Triangle

      A right-angled triangular array of natural numbers is called Floyd triangle. Building Floyd's triangle in C programming is quite easy, but you must have the understanding of how for loop works. Program: #include <stdio.h> int main() { int n, i, […]

        C Program to Create Pyramid

        C program to demonstrate, how you can print pyramid using for loop. Building a pyramid in c programming is quite easy, but you must have the understanding of how for loop works. Program: #include <stdio.h> #include <conio.h> void main() { […]

          C Program to Print Diamond Pattern

          This C code print stars, which makes a diamond pattern. Create diamond pattern in C by using nested for loop Program: #include <stdio.h> int main() { int n, c, k, space = 1; printf("Enter number of rows\n"); scanf("%d", &n); space […]

            C Program to Print Star Pattern

            This C code print stars, which makes different patterns. Create star triangle pattern in C by using nested for loop Program: #include <stdio.h> void main() { int i,j,k; for(i=1; i=i; j--) { printf(" "); } for(k=1; k=1;i--) { for(j=5;j>i;j--) { […]

              C Program to Change String Case

              This C program is used to change string case with and without using strlwr and strupr functions.

              • Lowercase using strlwr function.
              • Uppercase using strupr function.
              • Lowercase without strlwr function.
              • Uppercase without strupr function.

              Matrix Multiplication in C

              Matrix multiplication is another important program that makes use of the two-dimensional arrays to multiply the cluster of values in the form of matrices and with the rules of matrices of mathematics. In this C program, the user will insert the order for a matrix followed by that specific number of elements. This same thing will be repeated for the second matrix.

                C Program to Reverse a Sentence Using Recursion

                This C program takes a input from user and reverses that sentence using recursion. Program: #include <stdio.h> void reverse(); void main() { printf("Please enter a sentence: "); reverse(); } void reverse() { char c; scanf("%c", &c); if (c != '\n') […]

                  C Program to Insert an Element in an Array

                  This C program code will insert an element into an array, and it does not mean increasing size of the array. For example consider an array n[10] having four elements: n[0] = 1, n[1] = 2, n[2] = 3 and n[3] […]

                    C Program to Merge Two Arrays

                    C program to merge two arrays into one array, Arrays are assumed to be sorted in ascending order. Enter the two short sorted arrays and combine them to obtain a large array. Program: #include <stdio.h> void merge(int [], int, int […]

                      Scroll Back to Top