Write a c program which prints initial of any name





C code which prints initial of any name

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

Sample output:

Enter a string: Robert De Niro
RDN






3. Write a c program to delete the all consonants from given string.
Post a Comment