Thursday, January 7, 2010

45.WAP TO COUNT THE NO OF CHARACTERS IN A STRING

//WAP TO COUNT THE NO OF CHARACTERS IN A STRING.
#include
#include
#include
void main()
{
char str[20];
int c=0;
clrscr();
puts("\nENTER THE STRING:");
gets(str);
puts("\n\nENTERED STRING IS");
puts("\n\n");
puts(str);
c=strlen(str);
printf("\n\nNUMBER OF CHARACTERS IN A STRING=%d",c);
getch();
}
/*---------------------------------------------------------
OUTPUT
-----------------------------------------------------------

ENTER THE STRING:
ABHISHEK


ENTERED STRING IS



ABHISHEK


NUMBER OF CHARACTERS IN A STRING=8
*/

No comments:

Post a Comment

Programming the Whole World!