Stack Exchange
Printing the results of an aggregate function from a cursor
How do I retrieve the values of count in the cursor implementation using the record variable?
DECLARE 

   CURSOR cur_branch IS
    SELECT b.branchname, COUNT(a.applicantid) 
      FROM branch b, applicant a
     WHERE b.branchid=a.optedbranch
     GROUP BY b.branchname ORDER BY b.branchname;

BEGIN

   DBMS_OUTPUT.PUT_LINE('Branch Name No of Applicants opted');

   FOR v_branchrec IN cur_branch
   LOOP

      DBMS_OUTPUT.PUT(RPAD(v_branchrec.branchname,20)||'    '); 
      DBMS_OUTPUT.PUT_LINE(v_branchrec.COUNT(applicantid));

   END LOOP;

END;

This throws an error at DBMS_OUTPUT.PUT_LINE(v_branchrec.COUNT(applicantid)); stating that COUNT has to be declared and it can be used only in SQL and not in PL/SQL. 
I want to retrieve the number of students in every Branch.

You should define an alias for COUNT(a.applicantid) and refer to this column through this alias.  
 SELECT b.branchname, COUNT(a.applicantid) cnt FROM
...
 DBMS_OUTPUT.PUT_LINE(v_branchrec.cnt);


All you need to do is:

Use an alias for the COUNT(a.applicantid) column in your cursor definition:
  SELECT b.branchname, COUNT(a.applicantid) as cnt

In the LOOP use
  DBMS_OUTPUT.PUT_LINE(v_branchrec.cnt);


