Math, asked by DEEPTANSHA6917, 1 year ago

Write a c program to abbreviate the given sentence

Answers

Answered by sandew
5
#include< stdio.h>
#include< conio.h>
void main()
{
int i,j,k;
char a[30],b[30];

clrscr();
puts("enter your name : \n");
gets(a);

printf("\n\nyour name in short is : \n\n%c",a[0]);
for(i=0;a[i]!='\0';i++)
{
if(a[i]==' ')
printf(".%c",a[i+1]);
}
for(i=0;a[i]!='\0';i++)
{
if(a[i]==' ')
for(j=i,k=0;a[j]!='\0';j++,k++)
b[k]=a[j];
}

b[k]='\0';

for(i=2;b[i]!='\0';i++)
printf("%c",b[i]);

getch();
}
Similar questions