Saturday, August 18, 2018

LENGTH OF THE STRING

  • Problem Description

    Program which will accept string from the user and find the length of the string
  • CODING ARENA
  • #include <stdio.h>
    #include<string.h>
    int main()
    {
      char name[10];
      int n;
      scanf("%s",name);
      n=strlen(name);
      printf("%d",n);
      return 0;
    }
  • Test Case 1

    Input (stdin)
    welcome
    
    
    Expected Output
    7
  • Test Case 2

    Input (stdin)
    input
    
    
    Expected Output
    5

No comments:

Post a Comment