Social Icons

Tuesday, 18 February 2014

Program to find length of a string

#include<iostream.h>
#include<conio.h>

void main()
{
 clrscr();
 char a[30];
 int i;
 cout<<"\n Enter a string : ";
 gets(a);

 for(i=0;a[i]!='\0';++i);
 cout<<"\n Length of the sting is : "<<i;
 getch();
}


                                                   Output

No comments:

Post a Comment