Canna

Tuesday, 25 September 2018

Find no of characters in name

  • Problem Description

    Manoj arranged one event to find no of characters in his friends name, your idea is to give your friends name, for that
    manoj has to answer the no of characters present in it, with the help of sturcuture concept accomplish it.
    Input Method

    Name of different friends 

    Output Method

    No of characters


  • Test Case 1

    Input (stdin)
    raja
    
    
    Expected Output
    4
  • Test Case 2

    Input (stdin)
    rambabu
    
    
    Expected Output
    7
  • Program
  • #include <stdio.h>
    #include<string.h>
    struct slen
    {
      char str[100];
      int ln;
    }s;
    int main()
    {
      scanf("%s",s.str); 
      s.ln=strlen(s.str);
      printf("%d\n",s.ln); 
      return 0;
    }

No comments:

Post a Comment

Note: only a member of this blog may post a comment.