THIS PROGRAM IS WRITTEN ON REQUEST..
TO WRITE THE PROGRAM WITHOUT USING IN-BUILT FUNCTIONS SO HERE IT IS
#include<stdio.h>
void main()
{
char a[100];
int i=0,m=0;
printf("enter the sentence : \n");
while(i<100)
{
scanf("%c",&a[i]);
if(a[i]==' ') {m++;}
if(a[i]=='\n') break;
i++;
}
printf("the no of charecters: %d \n",i);
printf("the no of spaces: %d \n",m);
printf("the no of words: %d \n",m+1);
}
TO WRITE THE PROGRAM WITHOUT USING IN-BUILT FUNCTIONS SO HERE IT IS
#include<stdio.h>
void main()
{
char a[100];
int i=0,m=0;
printf("enter the sentence : \n");
while(i<100)
{
scanf("%c",&a[i]);
if(a[i]==' ') {m++;}
if(a[i]=='\n') break;
i++;
}
printf("the no of charecters: %d \n",i);
printf("the no of spaces: %d \n",m);
printf("the no of words: %d \n",m+1);
}
No comments:
Post a Comment