How good were Bill Gates and the late Steve Jobs at programming?
Over my 11 years at MSFT from the mid 80s to the late 90s I had numerous "Billg reviews" with different product teams, most frequently with the compiler group (C, C++). Bill's grasp of technical detail was scary and every group in the company prepared feverishly for these meetings, as he had an uncanny knack for asking the three questions that were (in hindsight) super important and which you and your team had somehow managed to not think of. The two themes he consistently explored were 1) How will this product be successful and 2) how will we make money with it? The first opened the door to deep drill-downs on product and technology specifics. For example, I remember one meeting well after the company was multi-billion-dollar-sized; the compiler team was looking into building a RISC compiler. We had acquired one of the top RISC compiler architects in the world. Bill conducted an amazing debate on the details of this kind of compiler with the architect in the meeting, just based on what he happened to know about RISC compilers with no clue we were even going to bring it up. Remember at that time he was overseeing a vast global empire with dozens of products; the compiler group was a wart on a flea's butt compared to Office, Server, Windows, and database products.
In short, at Microsoft in the early days, the level of IQ was truly extraordinary (somehow I got in anyway) and Bill stood out as a the smartest guy in any room of super-geniuses. I imagine his code reflected that level of intelligence, although I've never seen any of it.
One quick note about the personality stuff. Many people write about this but I rarely see it from people with first-hand experience. I had a few dealings with Apple in my work at MSFT but never with Steve Jobs, so I have no opinion about him. Bill could be scathing, but I personally never saw him attack anyone personally--only ideas. He hated imperfectly reasoned thought. I myself in my first meeting with him had him tell me I was wrong about some facts I presented. As soon as I showed him the actual data, he immediately reversed his opinion and accepted the data. If you came into a meeting with an opinion but no real data to back it up, he could and would tell you your idea was the "stupidest f***ing thing he'd heard." Newbies might get their feelings hurt, but old timers knew he meant the IDEA was stupid, not the person bringing it. Of course, if you DID do that once that itself was a datapoint about the person in Bill's famously long memory. So that person the next 20 encounters could count on being drilled relentlessly for data.