Program to find the length of the string entered by user
#include <stdio.h>
#include <conio.h>
void main()
{
int i= 0;
char ch, str[20];
clrscr();
printf ("Enter the string: ");
gets(str);
ch=str[0];
while (ch!='0')
{
i++;
ch= str[i];
}
printf ("Length is %d", i);
getch();
}
#include <stdio.h>
#include <conio.h>
void main()
{
int i= 0;
char ch, str[20];
clrscr();
printf ("Enter the string: ");
gets(str);
ch=str[0];
while (ch!='0')
{
i++;
ch= str[i];
}
printf ("Length is %d", i);
getch();
}