Friday, August 19, 2011

Program to find length of entered string.

//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();
}

Previous Next Home
0 Comments
Comments

Leave a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Twitter Delicious Facebook Favorites More