Best Programming Work

This is a code that I've done on a coding game application called "Sololearn". This application has many programming language that the users can learn. The code above is C++, the first programming language that I've learned. The reason why this code is very special to me is because it involved a lot of thinking before solving it. So basically I had a challenge where I am making a program for a bus service. The bus can transport 50 passengers at once. With the number of passengers waiting in the bus station as input, I'll need to calculate and output how many empty seats the last bus will have. It took me awhile to figure out how to solve this problem. I didn't want to cheat or to get help because I wanted to challenge myself. So one day when I was on a bus on my way home at night, I finally figured out how to solve it. You'll need four variables:

  • one that takes a value of 50 (bus)

  • one that takes an input from the user (passengers)

  • one that'll take the reminder of seats from the bus (reminder)

  • one that'll take the empty seats left in total from the last busĀ 

The "%" shows the reminder from the bus. And then you'll have to take the 50 from the "bus" variable, and substract the reminder from the bus to get the number of empty seats. And then I'll have to output the "lastBus" variable to show the number of empty seats the last bus will have. I'm proud of succeeding this challenge, and it showed me that when I think hard enough on a problem, I can easily do it on my own.