Advertisement
Guest User

2

a guest
Apr 4th, 2020
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5.     int i=1,j,n,t,c;
  6.     char s[200];
  7.     scanf("%d",&t);
  8.     while(i<=t)
  9.     {
  10.         c=1;
  11.         gets(s);
  12.         n=strlen(s);
  13.         for(j=0;j<n;j++)
  14.         {
  15.             if(s[j]==' ')
  16.             {
  17.                 c++;
  18.             }
  19.         }
  20.         printf("%d\n",c);
  21.         i++;
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement