In: Computer Science
Implement a program to jind out the percentage of the given marks to a student.
//Percentage of marks secured by a student.
import java.util.*;
public class Main
{
        public static void main(String[] args) {
         Scanner sc= new Scanner(System.in);
         System.out.println("Enter the no of subjects :");
         int n= sc.nextInt();     //no of subjects
         int sum=0;
         System.out.println("Enter marks of "+n+" subjects.");
         for(int i=0;i<n;i++)
         {
             int m=sc.nextInt();  //taking input marks in each subject
             sum=sum+m;    //calculating total marks secured.
         }
         float total= n*100;   //Total marks for the exam.
         float percent= (sum*100)/total;
         System.out.println("Percentage secured is "+percent+"%");
        }
}
