Solved programming problem

Please Enter a Massage:apple Your new message:#ppl#

Source code

#include <stdio.h>

int main()

{

    char str[100];

    int len=0,i=0;

    printf("Please Enter Massage: ");

    gets(str);

    for(i=0;str[i]!='�';i++) ///checking the string until NULL character

    {

        len++;

    }

    printf("Your Massage Length is: %d",len);

    return 0;

}

Output

Please Enter Massage:  Apple


Your Massage Length is:5

Join the discussion

Add your comment