Here's the common bad habit Bill Gates had to quit before he became successful

Bill Gates
Justin Sullivan | Getty Images

Today marks the 43rd anniversary of Microsoft. On April 4, 1975, billionaire Bill Gates co-founded the tech company with Paul Allen.

Before starting the company, Gates was a tech-obsessed teen at the Lakeside School. As the billionaire recalled in a 2005 speech, his school helped foster his love of computers. "Years before other schools recognized the importance of computers, the Lakeside Mothers Club came up with the money to buy a teletype that connected over the phone lines with a GE time-sharing computer," he said.

That machine changed the course of Gates' life and he spent much of his time at school fiddling with computers, hacking and coding. There, he also met Allen and the two bonded over their love of technology.

Although Gates helped turn Microsoft into a multi-billion dollar tech company, which analysts say could reach a $1 trillion valuation by 2020, he had to overcome some bad personal habits.

In a 2005 Q&A session with billionaire investor Warren Buffett, Gates told students at the University of Nebraska-Lincoln's College of Business Administration that he used to be a heavy procrastinator.

Gates developed this "very bad habit" as an undergraduate student at Harvard University (he dropped out after two years). "I liked to show people that I didn't do any work, and that I didn't go to classes and I didn't care," he told students.

But at the last minute, sometimes just two days before a test, Gates would get serious about his studies and quickly prepare. "People thought that was funny," he said. "That was my positioning: the guy who did nothing until the last minute."

However, these antics didn't fly when he entered the business world. "When I went into business that was a really bad habit and it took me a couple years to get over that," Gates said, causing the audience to laugh.

The Microsoft co-founder again discussed his past fondness for procrastinating in a 2016 Ask Me Anything Reddit post. When asked about his best memory at Harvard, Gates said, "I decided that I would be different and never attend any class I was signed up for but always attend a class I wasn't signed up for."

Shark Tank’s Robert Herjavec: Easy ways to keep your data safer
Shark Tank’s Robert Herjavec: Easy ways to keep your data safer

Another Reddit user asked how he then managed to pass his classes. Gates explained that he simply studied "really hard" during reading period, a small segment of time some colleges give students just before final exams.

By following this strategy, Gates wrote that he "almost always" received As. However, there was one exception. Upon reviewing the videotaped lectures for an organic chemistry class, he found that some had no sound or had faulty video. "That spooked me and I ended up getting a C+ in the course," Gates wrote on Reddit.

In his University of Nebraska panel discussion, Gates admitted that going into business was a sobering reality check. "Nobody praised me because I would do things at the last minute," he said. As a result, he tried to "reverse" his habit to become more like the students he knew in college "who were always organized and had things done on time."

Although the billionaire managed to mostly excel at school even with this bad habit, studies say that the cost of procrastination far outweighs the short-term freedom. According to Psychological Science, citing 20 years of research, procrastination causes one's quality of work and well-being to suffer.

While Gates may no longer wait until the last minute to complete important tasks, he told the students at the time that he's still a work in progress. "I'm still working on it," said the billionaire, "but procrastination is not a good habit."

Like this story? Like CNBC Make It on Facebook.

Don't miss: 4 behaviors that transform ordinary people into CEOs, according to a study of 2,600 leaders

This former FBI agent shares her best tips to avoid scams
This former FBI agent shares her best tips to avoid scams

This is an updated version of a previously published article.