View Code of Problem 58

#include<stdio.h>
#include<string.h>
int main()
{
  char a[100];
  int i,n;
  int sum=1;
  gets(a);
  n=strlen(a);
  for(i=0;i<len;i++)
  {
  if(a[i]>='A'&&a[i]<='Z'||a[i]>='a'&&a[i]<='z')
  {
   if(a[i-1]=='')
  }
    sum++;
  }
   printf("%d",sum);
  return 0;
}
/*
Main.c: In function 'main':
Main.c:8:3: warning: 'gets' is deprecated [-Wdeprecated-declarations]
   gets(a);
   ^~~~
In file included from Main.c:1:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
Main.c:10:13: error: 'len' undeclared (first use in this function)
   for(i=0;i<len;i++)
             ^~~
Main.c:10:13: note: each undeclared identifier is reported only once for each function it appears in
Main.c:12:15: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if(a[i]>='A'&&a[i]<='Z'||a[i]>='a'&&a[i]<='z')
      ~~~~~~~~~^~~~~~~~~~~
Main.c:14:15: error: empty character constant
    if(a[i-1]=='')
               ^~
Main.c:15:3: error: expected expression before '}' token
   }
   ^
Main.c:6:9: warning: variable 'n' set but not used [-Wunused-but-set-variable]
   int i,n;
         ^
*/

Double click to view unformatted code.


Back to problem 58