how to convert pulses to rpm

hi all, i'm a newbie here and to arduino
so i have a few questions

i'm trying to measuring dc motor rpm with quadrature encoder using arduino
but i only have code for showing the pulses, can anybody tell me how to convert pulses to rpm? or just the basic of it

here is my code :

const byte encoder0pinA = 2;//A pin
const byte encoder0pinB = 4;//B pin
byte encoder0PinALast;
int duration;
boolean Direction;

void setup()
{
Serial.begin(57600);
EncoderInit();
}

void loop()
{
Serial.print("Pulse:");
Serial.println(duration);
duration = 0;
delay(100);
}

void EncoderInit()
{
Direction = true;
pinMode(encoder0pinB,INPUT);
attachInterrupt(0, wheelSpeed, CHANGE);
}

void wheelSpeed()
{
int Lstate = digitalRead(encoder0pinA);
if((encoder0PinALast == LOW) && Lstate==HIGH)
{
int val = digitalRead(encoder0pinB);
if(val == LOW && Direction)
{
Direction = false; //Reverse
}
else if(val == HIGH && !Direction)
{
Direction = true; //Forward
}
}
encoder0PinALast = Lstate;

if(!Direction) duration++;
else duration--;

my teacher gave me those code, and i need to find out how to measuring rpm from the pulses, but i dnt know aything at all, i also done some research, but it takes a lot of parameter to converting pulses to rpm, thanks for your help

It depends on the encoder. How many pulses are produced in one full rotation of the shaft?

my motor datasheet said that it has 43.7:1 metal gearbox and an integrated quadrature encoder that provides a resolution of 64 counts per revolution of the motor shaft, which corresponds to 2797 counts per revolution of the gearbox’s output shaft

but i dnt know how to count it, can you please tell me the basic of it, or the arithmetic?

Why its simple algebra.

revolutions/minute = (counts/minute) / (counts/revolution)

so thats it sir?

allright i'm gonna try it first, thank you so much for both of you sir, you'll be blessed