My
Name
Is
Sagar
Devkota
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include<stdio.h>
void nline(char []);
void main()
{
char asent[100];
int i;
printf("Enter a line of string:- \n");
gets(asent);
nline(asent);
puts(asent);
}
void nline(char thesent[100])
{
int i;
for (i=0;thesent[i]!='\0';i++)
{
if (thesent[0]>='a' && thesent[0]<='z')
thesent[0]=thesent[0]-32;
if(thesent[i]==' ')
{
thesent[i]='\n';
if(thesent[i+1]>='a' && thesent[i+1]<='z')
thesent[i+1]=thesent[i+1]-32;
}
}
}
|
Here we Check the case of First and make it capital if it was small. Then check every space and replace it with Newline "\n". and Make Capital all after that space.
0 comments:
Post a Comment