Welcome to the forums, @akhilmukkamala.
That sounds like some kind of homework assignment. (That's not a problem; we're happy to help with any questions.)
How far have you got with this, and at what point do you need help? Please post whatever code you have so far for others to see. (To display code correctly here, you can highlight your code, then use the
</> button in the editor window, which will format it, or you can place three backticks ``` (top left key on US/UK keyboards) on a line before your code, and three on a line after your code. I find this approach easier, but unfortunately some European and other keyboards don't have that character.)