You are on page 1of 1

clc;

clear all;
close all;
a=input('enter the value of number a=');
b=input('enter the value of number b=');
p=input('enter the value of number p=');
n=input('enter the value of number n=');
N=a.*b;
x=floor(n/2^n);
u=floor(2^(2.*n)/p); %pre computation factor
flr=floor(x.*u);
r=N-(flr.*p)
r1=r-p;
if r1>=0
disp(r)
else disp(r)
end

You might also like