C Exercises: Check if a string is present in the last part of another string
Check if a string ends with another string
Write a C program that accepts two strings and checks whether the second string is present in the last part of the first string.
Sample Solution:
C Code:
Sample Output:
Input the first string: abcdef Input the second string: ef Is second string present in the last part of the first string? Present!
Flowchart:

For more Practice: Solve these Related Problems:
- Write a C program to check if one string is a suffix of another using pointer comparisons.
- Write a C program to determine whether the second string occurs at the end of the first string by comparing lengths and characters.
- Write a C program to implement a function that checks for a substring at the end of a string without using library functions.
- Write a C program to compare two strings and print "Present!" if the first string ends with the second using loops.
C programming Code Editor:
Previous: Write a C program to create an array of length n and fill the array elements with integer values. Now find the smallest value and it’s position within the array.
Next: Write a Java program to find heights of the top three building in descending order from eight given buildings.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.