C Program Which Prints the Initial Of Any Name

C program to print the initial character of any string

There we will see the c program which is print the initial character of each string. In which we use the character array.
For Example:
if we take input from user: “C Programming Simply”
there is three string value and the Initial character of each string is CPS

ALGORITHM:-

step 1 : Start
step 2 : Take an character array
step 3 : Take the input from user
step 4 : While(string[i]!='')
step 5 : If [i]th value is ' '(space) then the print the i+1 character
step 6 : Exit

PROGRAM CODE:-

#include<stdio.h>
#include<stdio.h>

int main()
{
char str[20];
int i=0;
printf("Enter a string: ");
gets(str);
printf("%c", *str);
while(str[i] != '')
{
if(str[i] == ' ')
{
i++;
printf("%c", *(str + i));
}
i++;
}
return 0;
}

OUTPUT:-

Enter a string:
C Programming Simply

CPS

C program to print the initial character of any string
print the initial character value in a given string using c
Starting character of any string