[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
Printable View
کد:
#include <stdio.h>
int main()
{
char ch,ch1=' ';
int tw=0,tk=-1;
printf("\nplz enter text:\n");
while(ch!='\n')
{
scanf("%c",&ch);
tk ++;
if((ch== ' '||ch=='\n')&& ch1!=' ') tw ++;
ch1=ch;
}
printf("\n number of words =%d\n number of characters=%d",tw,tk);
}