Write a java program using scanner method, to read and display the following details: Name -- as a String data type ; ROLLNO-- as a integer data type ; Enter marks of 5 subjects-- as a float data type Compute and display the percentage of marks.

 import java.util.*;

class q5

{

    public static void main(String args[ ])

    {

        Scanner sc=new Scanner(System.in);

        System.out.println("ENTER YOUR NAME");

        String n=sc.next();

        System.out.println("ENTER YOUR ROLL NO.");

        int r=sc.nextInt();

        System.out.println("ENTER YOUR MARKS OF FIVE SUBJECTS");

        float m1=sc.nextFloat();

        float m2=sc.nextFloat();

        float m3=sc.nextFloat();

        float m4=sc.nextFloat();

        float m5=sc.nextFloat();

        float t=(m1+m2+m3+m4+m5)/5 *100;

        System.out.println("TOTAL PERCENT="+t);

       }

}

PROGRAM :


OUTPUT:



Comments

Popular posts from this blog

Write a menu driven program to accept a number from the user and check whether it is a Buzz number or an Automorphic number. i. Automorphic number is a number, whose square's last digit(s) are equal to that number. For example, 25 is an automorphic number, as its square is 625 and 25 is present as the last two digits. ii. Buzz number is a number, that ends with 7 or is divisible by 7.

Write a program in Java that takes input using the Scanner class to calculate the Simple Interest and the Compound Interest with the given values: i. Principle Amount = Rs.1,00,000 ii. Rate = 11.5% iii. Time = 5 years Display the following output: i. Simple interest ii. Compound interest iii. Absolute value of the difference between the simple and compound interest.