VOOZH about

URL: https://www.geeksforgeeks.org/c/c-program-to-find-initials-of-a-name/

⇱ C Program To Find Initials of a Name - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C Program To Find Initials of a Name

Last Updated : 4 Jul, 2022

Here, we will see how to find the initials of a name using a C program. Below are the examples:

Input: Geeks for Geeks
Output: G F G
We take the first letter of all
words and print in capital letter.

Input: Jude Law
Output: J L

Approach:

  1. Print the first character in the capital. 
  2. Traverse the rest of the string and print every character after space in capital letters.

Below is the C program to print the initials of a name:


Output
Your initials are: G F G 

Time Complexity: O(n), where n is the length of the string.

Auxiliary Space: O(1), as constant extra space is used.

Comment
Article Tags: