#include<stdio.h>
int main()
{
char str[20];
int i=0;
printf("Enter a string: ");
gets(str);
printf("%c",str[0]);
while(str[i]!='\0')
{
if(str[i]==' ')
{
i++;
printf("%c",str[i]);
}
i++;
}
return 0;
}
Output of program
Enter a string: ABC PATEL
AP
int main()
{
char str[20];
int i=0;
printf("Enter a string: ");
gets(str);
printf("%c",str[0]);
while(str[i]!='\0')
{
if(str[i]==' ')
{
i++;
printf("%c",str[i]);
}
i++;
}
return 0;
}
Output of program
Enter a string: ABC PATEL
AP
No comments:
Post a Comment