Video Coming Soon...

Created by Zed A. Shaw Updated 2026-11-26 20:48:52
 

48: numfmt

WARNING: This is from the Go course but I'm rewriting the code and the description to fit C. If you want to attempt it go ahead. The challenge is the same, just no examples yet.

The key to solving numfmt is to understand that it's replicating an international standard for displaying numbers that is absolutely insane. Don't try to make sense of it. Just assume someone who probably says things like, "Half past two quarters near 3pm" also decided that 1,200,000 would 1.2M but that 10,001,000 would be 11M.

A quick hint is you can get the magnitude of a number with:

// FIX: NEED THIS IN C

The Challenge

You are required to implement the SI style of number output up to, but not including billions. Everything above billions will be printed out exactly with besos at the end. If you want you can go as far as you want with this, but the pattern gets stranger the larger you get.

Previous Lesson Next Lesson

Register for From Impostor to Programmer

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.