Tuesday, 17 March 2015

Program to find the length of the given string Using C

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

void main()
{
char str[80] ;
int i ;
clrscr() ;
printf("Enter the string : ") ;
gets(str) ;
for(i = 0 ; str[i] != '\0' ; i++) ;
printf("\nThe length of the string is : %d", i) ;
getch() ;
}

RUN 1 :
~~~~~~~
Enter the string : welcome
The length of the string is : 7

1 comment:

  1. C++ program to Find Length of String

    Length of String is the number of character in the given String. For Example: String="Language" this string have 8 characters also this string is the size of string.

    ReplyDelete