import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); System.out.println("Enter the no of days"); int rowsize = sc.nextInt(); sc.nextLine(); double [][] sales = new double[rowsize][]; System.out.println(Arrays.toString(sales)); double sum =0.0; for(int i=0;i<rowsize;i++){ System.out.println("Enter the no of sales on day "+(i+1)); int n = sc.nextInt(); sc.nextLine(); sales[i]=new double[n]; System.out.println("enter the amount for day "+(i+1)); for(int j=0;j<n;j++){ sales[i][j] = sc.nextDouble(); sum+=sales[i][j]; } } for(int i=0;i<sales.length;i++){ System.out.println("say :"+(i+1)+" ---> "+Arrays.toString(sales[i])); } System.out.println("Average sale ----> "+(sum/rowsize)); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter