Thursday, November 22, 2012

C PROGRAM FOR FINDING LENGTH OF THE STRING



/*C PROGRAM FOR FINDING LENGTH OF THE STRING*/

#include<stdio.h>
#include<conio.h>

void main()
{
      char str[50];
      int k;
      clrscr();
      printf("\n\t FINDING LENGTH OF THE STRING");
      printf("\n\t ~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
      printf("\n Enter the string:");
      gets(str);
      k=0;
      while(str[k]!='\0')
       k++;
      printf("\n The length is %d",k);
      getch();
}





























OUTPUT:
        FINDING LENGTH OF THE STRING
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
 Enter the string: KRK

 The length is : 3


0 comments:

Post a Comment