JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<style>
table, th, td {
border:1px solid black;
}
</style>
<body>
<h2>Tab 3</h2>
<table style="width:100%">
<tr>
<th>Year</th>
<th>Outflow</th>
<th>Inflow</th>
</tr>
<tr>
<td>Year 0</td>
<td><input type="text" id="out0"></td>
<td><input type="text" id="in0"></td>
</tr>
<tr>
<td>Year 1</td>
<td><input type="text" id="out1"></td>
<td><input type="text" id="in1"></td>
</tr>
<tr>
<td>Year 2</td>
<td><input type="text" id="out2"></td>
<td><input type="text" id="in2"></td>
</tr>
<tr>
<td>Year 3</td>
<td><input type="text" id="out3"></td>
<td><input type="text" id="in3"></td>
</tr>
<tr>
<td>Year 4</td>
<td><input type="text" id="out4"></td>
<td><input type="text" id="in4"></td>
</tr>
<tr>
<td>Year 5</td>
<td><input type="text" id="out5"></td>
<td><input type="text" id="in5"></td>
</tr>
</table>
<br>
<form>
Discount rate: <input type="text" id="dr">
<br>
Result: <input type="text" id="result">
<br>
<input type="button" value="NPV" onClick="npv()">
<input type="button" value="IRR" onClick="irr()">
<input type="button" value="PP" onClick="pp()">
</form>
</body>
JavaScript
function npv()
{
var in0, in1, in2, in3, in4, in5, out0, out1, out2, out3, out4, out5, dr, res;
dr=parseFloat(document.getElementById('dr').value);
in0=parseFloat(document.getElementById('in0').value);
in1=parseFloat(document.getElementById('in1').value);
in2=parseFloat(document.getElementById('in2').value);
in3=parseFloat(document.getElementById('in3').value);
in4=parseFloat(document.getElementById('in4').value);
in5=parseFloat(document.getElementById('in5').value);
out0=parseFloat(document.getElementById('out0').value);
out1=parseFloat(document.getElementById('out1').value);
out2=parseFloat(document.getElementById('out2').value);
out3=parseFloat(document.getElementById('out3').value);
out4=parseFloat(document.getElementById('out4').value);
out5=parseFloat(document.getElementById('out5').value);
res=(((in0-out0)/((1+(dr/100))**0))+((in1-out2)/((1+(dr/100))**1))+((in2-out2)/((1+(dr/100))**2))+((in3-out3)/((1+(dr/100))**3))+((in4-out4)/((1+(dr/100))**4))+((in5-out5)/((1+(dr/100))**5)));
document.getElementById('result').value=res;
}