Why is the program not working

the given example is running fine

here without using stackhttps://ide.codingblocks.com/s/684720