Issue with a lab

      int num =5;  
      int sumd = sum(num);
      println(“The sum of the digits is ”  + sumd);

      int sum(int n)
      {
      int ctr;
      int sd=0;
      if (n <=0)
      sd = n;
      else
      {
      for(ctr = 1; ctr <= n; ctr++)
      sd += ctr;
      }
      return (sd);
      }

It returns void on line 3 saying unexpected char '\' even though there is no \

Answers

Sign In or Register to comment.