Basic calculator(it is showing exception in thread main java no such element exception found)

Hi @naman19179,
The code that you sent has two blocks of the same code . So in a case where the user whats to just do three operations then in that case the user will not have invalid operation for second case. Please make this a single looped so that it runs for odd case as well. I would suggest you to remove all the content below the else invalid block. Give it a try otherwise i will provide you the solution .

Further to explain more the content in the else block after the invalid operation call is not necessary . You will also have to check whether the n2 in case of divide is not zero as stated.

it is not working even now…the new code is