#include <stdio.h>
#include <stdlib.h>
void main()
{
char a[100];
int i,c=0;
printf("enter the text: ");
scanf("%20s",a);
for(i=0;a[i]!='\0';i++)
{
if(a[i]==32)
{
c++;
}
}
printf("number of spaces in text is %d",c);
}
ascii value of space is 32 but it shows o spaces in output
rithish 13 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.