program calculator
implicit none
!DECLARATION
integer::A,B
integer::result_
integer::choice
!RETRIEVING INPUT
print*, 'Input the first parameter '
read*,A
print*, 'Input the second parameter '
read*,B
!OPERATION SELECTION
print*, 'Kindly select the operation you want to perform on the two inputs '
print*, '1. ADDITION '
print*, '2. SUBTRACTION '
print*, '3. MULTIPLICATION '
print*, '4. DIVISION '
read*, choice
if (choice==1) then
!ADDITION OPERATION
result_ = A+B
print*, 'ADDITION:', A, '+', B, '=',result_
elseif (choice==2) then
!SUBTRACTION OPERATION
result_ = A-B
print*, 'SUBTRACTION :', A, '-', B, '=',result_
elseif (choice==3) then
!MULTIPLICATION OPERATION
result_ = A*B
print*, 'MULTIPLICATION:', A, '*', B, '=',result_
elseif (choice==4) then
!DIVISION OPERATION
if(B/=0) then
result_ = A/B
print*, 'DIVISION:', A, '/', B, '=',result_
else
print*, 'Error!!!!'
endif
else
print*,'Invalid Selection!!!'
endif
end program calculator
To embed this project on your website, copy the following code and paste it into your website's HTML: