C program to find length of entered sentence or string.

/*C program to find length of string*/
#include <stdio.h>
#include <string.h>
#include <conio.h>
 void main()
{
char a[100];
int length;
printf("Enter a string to calculate it's length\n");
gets(a);
length = strlen(a);
printf("Length of entered string is = %d\n",length);
getch();
}

Expected Output:
Enter a string to calculate it's length
It is c programming
Length of entered string is =19

Post a Comment

Previous Post Next Post