Sunday 11 December 2011

Write a program to length of String in c

#include
#include
void main()
{
char str[100];
int len=0,i;
clrscr();
printf("Enter A String:");
gets(str);
for(i=0;str[i]!='\0';i++)
{
len++;
}
printf("The Lenth of The String is:%d",len);
getch();
}


OUTPUT

Enter A String: MAHESH SOLANKI
The Length of The String is : 15

No comments:

Post a Comment