Computer Science, asked by sunnyshaniya575, 3 months ago

Write a Java program: To input marks of five subjects from the user Calculate total and average of those marks
without using scanner class and for loop statement.

Answers

Answered by dattarajshinde44
2

Answer:

import java.util.*;

public class Question {

 public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    System.out.println("Input marks of five subjects");

for (int i=1;i<5;i++) {

    int n = sc.nextInt();

    int a = a+n;

}

System.out.println("Total = "+a);

double b = a/5;

System.out.println("Average = "+b);

}

}

Similar questions