For the first time I my programming experience I encountered the dangling if else in C.

Question:

Read a number,If it is an Armstrong number,then generate primes upto that number.

The solution which seems to be right but infected with the dangling if else is given below:



The right solution is: (Just a couple of extra braces.)
The "else" belongs to the "if" right behind it,which causes the dangling if else problem when no braces are used.This problem is not found in languages like python as the indentation demarcates the blocks.