C Program to accept your name and find its length

 C Program To Write your name and find the length of the string

#include<stdio.h>
int main()
{
	char a[50];
	printf("Enter your name : ");
	scanf("%s",&a);
	printf("The name entered is %s",a);
	printf("\nThe first character is : %c",a[0]);
	int length=strlen(a);
	printf("\nThe length of the name is %d",length);
	
}


Output:


Explanation:

    Here ,we get the input through scanf and give the output using printf ,

 the length of the string is found using strlen function.

Previous Post Next Post