Write a program in C to find the number of characters in given string.
#include<stdio.h> #include<string.h> #include<conio.h> void main() { int i; char str[100]; printf("enter a string:-"); gets(str); for(i=0;str[i]!='\0';i++); printf("Number of characters=%d",i); getch(); }
Output :-
Related programs:
- Write a program in C to read multiple string and then print.
- Write a program in C to find the number of characters in given string using pointer.
- Write a program in C to covert small letter to capital letter.
- Write a program in C to covert capital letter to small letter.
- Write a program in C to print month in word.
0 Comments