164. C Program to find Number of Blank Spaces in a given Line.
How does this program work?
- This Program is used to count the blank spaces form the given line.
Here is the code
#include <string.h>
int main()
{
//To find the blank spaces of a given string
char str[50];
int i,count =0;
puts("Enter a string : \n");
gets(str);
for(i=0;str[i];i++)
if(str[i] == ' ')
count++;
printf("Total blank spaces : %d\n",count);
return 0;
}