Answer to Question #43468 in Java | JSP | JSF for Sam Ananth

Question #43468
write a program to accept the name of a student and 10 subject marks of the student.calculate the total and the average.
1
Expert's answer
2014-06-19T08:57:51-0400
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.Scanner;
public class Student_app {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String name = "";
double total=0;
Scanner sc = new Scanner(System.in);
System.out.print("Name=");
name=sc.nextLine();
for (int i = 0; i < 10; i++) {
System.out.print((i+1)+"=");
total+=sc.nextInt();
}
System.out.println("Name= "+name);
System.out.println("total= "+total);
System.out.println("average= "+(double)(total/10));

}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS