10. Display the short form of a string. E.g. Computer Science : CS
#include<stdio.h>
int main(){
char str[50];
int i=0;
clrscr();
printf("Enter a string: ");
gets(str);
printf("%c",*str);
while(str[i]!='\0'){
if(str[i]==' '){
i++;
printf("%c",*(str+i));
}
i++;
}
getch();
return 0;
}
No comments:
Post a Comment