Length of the String

Description:

Program which will accept string from the user and find the length of the string Test Case 1 Input (stdin) welcome Expected Output 7 Test Case 2 Input (stdin) input Expected Output 5

Program :


#include <stdio.h>

#include <string.h>

 

int main()

{

  char a[100];

  int length;

  scanf ("%[^\n]s",a);

  length = strlen(a);

  printf("%d\n", length);

  return 0;

}