CSCI-111 Study Guide - Quiz Guide: Array Data Structure
64 views2 pages
16 Jul 2020
School
Department
Course
Professor
Document Summary
Create an array elements with user inputs, find max and min values, calculate average. Created a floating array with size of 5. Finds max and min value of array elements, calculate average of the array floating elements. Main class code public class main { public static void main(string[] args) { float max; // maximum number of array float min; // minimum number of array float sum =0; // sum of the array elements. Scanner kb = new scanner (system. in); // scanner object to take user input. // create an float array (named score) with 5 element float[] score = new float[5]; // initializes an array with user input for (int i=0;i<5;i++){ // get the 5 float number user input. // initialize user inputs into an array score[i]=kb. nextfloat (); // add all user inputs and assign it into float sum variable sum = sum+score[i];
Get access
Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers