Close
Close

Write a program to calculate the average height of all the students of a class. The number of students and their heights in a class are entered by

   Nikhiltony

  • Please use detail box to enter your complete question.
    - Aakhya Singh
  • in oop
    - alihamzabashir0@gmail.com
  • I recently availed myself of the reliable services for writing literature reviews https://literaturereviewwritingservice.com/ , and I am beyond satisfied. The team exhibited a deep understanding of my research area, crafting a literature review that exceeded my expectations. Their commitment to quality, attention to detail, and adherence to deadlines were commendable. If you're in search of a dependable service for literature review writing, this is the one.
    - maxkvinton

Answers

  •   

    The following code prints the average height of the students.

    import java.util.*;
    
    class Avg{
      public static void main(String[] args){
      	
      	float sum = 0, avg;
      	
        Scanner s1 = new Scanner(System.in);
        
        System.out.println("Enter number of students");
        int n = s1.nextInt();
        
        System.out.println("Enter height of students");
        
        for (int i = 0; i < n; i++) {
        	System.out.println("Student " + (i+1) + ":");
        	float height = s1.nextFloat();
        	sum = sum + height;
        }
        
        avg = sum/n;
        System.out.println("Average heigth : " + avg);
      }
    }
    

     



  •    seoexpertim

    I’m happy I located this blog! From time to time, students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. nice one advanced drainage systems houston



  •    frederickgragg

    The all-new Platform-App-Builder Certification Exam for 2023! Elevate your career and stay at the forefront of Salesforce expertise with this updated certification. Designed to reflect the latest industry trends and Salesforce innovations, this exam ensures you possess the skills and knowledge to excel in app development. Whether you're a seasoned professional or just starting your journey, our comprehensive study materials and practice tests will empower you to succeed. Stay competitive in today's dynamic job market, showcase your mastery of Salesforce, and open new doors of opportunity. Get certified and unlock your potential with the Platform-App-Builder Certs Exam [2023].



  •    maxkvinton

    The article on the "Paper Writing Service That Stole the Show in 2023" was an enlightening read. It offered an unbiased perspective on the top services in the industry without naming them directly. This article was instrumental in guiding me towards a dependable paper writing service, saving me time and effort. I highly recommend best paper writing services - clevescene.com it to all students seeking professional paper writing support.



Ask Yours
Post Yours
Write your answer