#include<stdio.h>
#include<conio.h>
main()
{
char ch[100];
int i;
clrscr();
printf("Enter any string:");
/*to accept multi word string gets() is used*/
gets(ch);
i=0;
printf("\n%c",ch[0]);
while(ch[i]!='\0')
{
if(ch[i]==' ')
{
i++;
printf("%c",ch[i]);
}
i++;
}
getch();
}
OUTPUT:
Enter any string: Achromatic String
AS
#include<conio.h>
main()
{
char ch[100];
int i;
clrscr();
printf("Enter any string:");
/*to accept multi word string gets() is used*/
gets(ch);
i=0;
printf("\n%c",ch[0]);
while(ch[i]!='\0')
{
if(ch[i]==' ')
{
i++;
printf("%c",ch[i]);
}
i++;
}
getch();
}
OUTPUT:
Enter any string: Achromatic String
AS
No comments:
Post a Comment