//chapter 6 Ex 2 clc; clear; close; n=40; Sum=n*(n+1)/2; //formula for sum of first n natural numbers avg=Sum/n; mprintf("The required average is %.1f",avg);