1 2 3 4 5 6 7 8 9 10 11
clc //initialization of variables k=20 //lb/in x=3 //in //calculations function [y]=fun(x) y=k*x endfunction w=intg(0,3,fun) //results printf("Work done = %d in-lb",w)