//Program to find length of entered string.
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str[20],c={0};
int l,i=-1;
clrscr();
printf("Enter the string: ");
while(1)
{
i=i+1;
scanf("%c",&c);
if(c=='\n')
{
str[i]='\0';
break;
}
str[i]=c;
}
l=strlen(str);
printf("The string is:");
puts(str);
printf("the length of string is %d",l);
getch();
}
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str[20],c={0};
int l,i=-1;
clrscr();
printf("Enter the string: ");
while(1)
{
i=i+1;
scanf("%c",&c);
if(c=='\n')
{
str[i]='\0';
break;
}
str[i]=c;
}
l=strlen(str);
printf("The string is:");
puts(str);
printf("the length of string is %d",l);
getch();
}