% rosza.m % by Keith Richards March 2006 % ticket price calculator clc,clear n_row = 7; n_col = 9; net_tickets = input('Enter total ticket $ '); atp = net_tickets/n_row/n_col; fprintf('\n') fprintf('Table 1: Cost of tickets for an event \n') fprintf('Seat #') fprintf('%6.0f',1:n_col) for i=1:n_row fprintf('\nRow %1.0f ',i) for j=1:n_col if i<4 & (j>2 & j<8) ticket(i,j)=atp*1.3; elseif i>5 & (j<3 | j>7) ticket(i,j)=atp*.8; else ticket(i,j)=atp; end fprintf('%6.0f',ticket(i,j)) % print prices across the row end end fprintf('\n \n')