WAP to calculate the how many characters enter by user


#include<stdio.h>
#include<conio.h>
void main()
{
	char str[20];
	int i,c=0;
	clrscr();

	printf("\n enter any string:");
	gets(str);
	for(i=0;i<str[i];i++)
	{
		c++;
	}
	printf("\n no. of character entered in a string is::%d",c);
	getch();


}

No comments:

Post a Comment