Example & Tutorial understanding programming in easy ways.

Write a program to titled the given string

program:

#include<stdio.h>

int main()

{

    char s[30],s1[30];

    int i=0;

    printf("Enter the stringn");

    gets(s);

    while(s[i]!=0)

    {

        if(i==0)

        s1[i]=s[i]-32;

        else

        if(s[i-1]==32)

        s1[i]=s[i]-32;

        else

        s1[i]=s[i];

        i++;

    }

    s1[i]='';

    printf("nTitled String is : %s",s1);

}

output:

Enter string

this is my string

Titled string is : This Is My String

Read More →