Social Icons

Friday, 14 February 2014

Program to find length of a string

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

void main()
{
int i;
char str[50];
clrscr();
printf("\n Enter a string : ");
gets(str);

for(i=0;str[i]!='\0';++i);
printf("\n Length of string is : %d",i);
getch();
}

                                                    Output

No comments:

Post a Comment