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

No comments:

Post a Comment