C/C++

6 Comments

To count the number of vowels in a given string

Here is a program to count number of vowels present in an entered sentence. Logic:  Here variable ‘vowels’ is incremented whenever a vowel found in tracing. Logic behind this is very simple, that comparing each character to the set of vowels, predefined in an array. If this character is in the set of vowels then […]

13 Comments

To count the number of words in a given string

This is the program to count number of words in the entered sentence. Logic: The logic behind this program is checking if the character in the sentence is a ‘blank’ and with the conditions that the next is not a blank character, or current character position is not equal to length of the sentence. If […]

No Comments

Program to find the transpose of a Matrix

Here is the program to transpose the entered matrix. The program asks for the order (M, N) of the matrix Soon after entering the order, the cursor takes to the proper position in the screen to input the matrix. User need to hit ‘Enter’ button after each entry. Logic :  A simple logic lies here. […]

4 Comments

To find the sum of secondary diagonal of a Matrix

Here is the program to find the sum of the secondary diagonal elements (From right top to  left bottom ) of the entered integer square matrix. The program asks for the order (M, N)  [where M should equal N] of the matrix. Soon after entering the order, the cursor takes to the proper position in […]

2 Comments

To find the sum of primary diagonal of a Matrix

Here is the program to find the sum of the primary diagonal elements (From left top to right bottom) of the entered integer matrix. The program asks for the order (M, N)  [where M should equal N] of the matrix. Soon after entering the order, the cursor takes to the proper position in the screen […]

1 Comment

To multiply two Matrices

Here is the program to find the product of the two integer matrices. The program asks for the order A (M, N) of the first matrix, and that B (P, Q) of the second matrix.  Soon after entering the order, the cursor takes to the proper position in the screen to input the matrices. User […]

1 Comment

To find the difference of two Matrices

Here is the program to find the difference between the two integer matrices. The program asks for the order (M, N) of the matrices. Soon after entering the order, the cursor takes to the proper position in the screen to input the matrices. User need to hit ‘Enter’ button after each entry. Logic : The […]

1 Comment

To find the sum of two Matrices

Here is the program to find the sum of the two integer matrices. The program asks for the order (M, N) of the matrices. Soon after entering the order, the cursor takes to the proper position in the screen to input the matrices. User need to hit ‘Enter’ button after each entry. Logic :  The […]

15 Comments

Program to sort the numbers using selection sort

Here is the program to sort the given integer in ascending order using selection sort method. Please find the link to the pictorial tutor of the sorting. This program needs to enter the length of the entering array, followed by the array to be sorted. The entered integers are stored in the array A. Logic […]

194 Comments

Insertion sort in C program

Here is the program to sort the given integer in ascending order using insertion sort method. Please find the pictorial tutor of the insertion sorting. Logic : Here, sorting takes place by inserting a particular element at the appropriate position, that’s why the name-  insertion sorting. In the First iteration, second element A[1] is compared […]