189k views
2 votes
Write a c program that prints the initial letter of name​

1 Answer

4 votes

Answer:

#include<stdio.h>

#include<string.h>

int main(){

char str[20];

int i=0;

printf("Enter a name: ");

gets(str);

printf("%c",*str);

while(str[i]!='\0'){

if(str[i]==' '){

i++;

printf("%c",*(str+i));

}

i++;

}

return 0;

}

Step-by-step explanation:

User Adam Owczarczyk
by
4.9k points