C program to trim trailing white space from a string

Write a C program to trim trailing/end white space characters in a string using loop. How to remove trailing blank space characters from a given string using loop in C programming. Logic to delete all trailing white space characters from a given string in C.

Example

Input

Input string: "Lots of trailing white spaces.      "

Output

String after removing trailing white spaces: 
"Lots of trailing white spaces."

Read more

C program to trim leading white spaces from a string

Write a C program to trim leading white space characters from a given string using loop. How to remove leading white space characters from a given string using loop in C programming. Logic to remove leading/starting blank spaces from a given string in C programming.

Example

Input

Input string:       Lots of leading space.

Output

String after removing leading white spaces: 
Lots of leading space.

Read more

C program to remove all repeated characters in a string

Write a C program to remove all repeated characters in a string using loops. How to remove all duplicate characters from a string using for loop in C programming. Program to find and remove all duplicate characters in a string. Logic to remove all repeated character from string in C program.

Example

Input

Input string: Programming in C.

Output

String after removing duplicate characters: Progamin C.

Read more

C program to count occurrences of a word in a string

Write a C program to count occurrences of a word in a given string using loop. How to count total occurrences of a given word in a string using loop in C programming. Logic to count occurrences of a word in given string.

Example

Input

Input string: I love programming. I love Codeforwin.
Input word to search: love

Output

Total occurrences of 'love': 2

Read more

C program to remove all occurrences of a word in string

Write a C program to remove all occurrences of a given word in string using loop. How to remove all occurrences of a word in given string using for loop in C programming. Deleting all occurrences of a word in given string in C program. Logic to remove all occurrences of a word in given string.

Example

Input

Input string: I love programming. I love Codeforwin.

Input word to remove: I

Output

String after removing 'I':
 love programming.  love Codeforwin.

Read more

C program to find maximum and minimum elements in array using recursion

Write a C program to find maximum and minimum elements in an array using recursion. How to find maximum and minimum element in an array using recursion in C programming. Logic to find find maximum or minimum elements in array in C programming.

Example

Input

Size of array: 10
Elements in array: 5, 1, 6, 10, 2, 3, 6, 50, -7, 4

Output

Maximum element = 50
Minimum element = -7

Read more

C program to find sum of array elements using recursion

Write a C program to find sum of array elements using recursion. How to find sum of array elements using recursive function in C programming. Logic to find sum of array elements using recursion in C program.

Example

Input

Input size of array: 10
Input array elements: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

Output

Sum of array: 55

Read more

C program to print elements of array using recursion

Write a C program to print all elements of array using recursion. How to display all elements of an array using recursion. Logic to print array elements using recursion in C programming.

Example

Input

Input size: 10
Input elements: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

Output

Array elements: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

Read more

Function, recursion programming exercises and solutions in C

A function is a collection of statements grouped together to do some specific task. In series of learning C programming, we already used many functions unknowingly. Functions such as – printf(), scanf(), sqrt(), pow() or the most important the main() function. Every C program has at least one function i.e. the main() function.

Function provides modularity to our program. Dividing a program in different modules makes it easy to maintain, debug and understand the code.

Read more