Design and Develop a java program to read marks of a student and print the total and average of marks using scanner class.

 /*

Design and Develop a java program to read marks of a student and print 

the total and average of marks using scanner class.

*/

import java.util.*;

class Twenty

{

    public static void main(String arg[])

    {

        int n,sum=0,avg;

        Scanner in = new Scanner(System.in);

        System.out.print("\n Enter number Of Subjects : ");

        n = in.nextInt();

        int a[] = new int[n];

        for(int i=0; i<n; i++)

        {

            System.out.print("Enter Mark value [" + (i+1) + "] : ");

            a[i] = in.nextInt();

            sum = sum + a[i];

        }

        System.out.println("\nTotal Marks Is : " + sum);

        avg = sum / n;

        System.out.println("\nAverage Is : " + avg);

    }

}

More Information on our channel Programmer Community

please like , share and subscribe to get notifications of new videos....

To understand this program video will coming soon on our you tube channel







Comments

Popular posts from this blog

Write a Java program to convert seconds to hour, minute and seconds.

Write a Java program to print the ascii value of a given character.