How to get 100% CPU usage from a C program
If you want 100% CPU, you need to use more than 1 core. To do that, you need multiple threads. Here’s a parallel version using OpenMP: I had to increase the limit to 1000000 to make it take more than 1 second on my machine. #include <stdio.h> #include <time.h> #include <omp.h> int main() { double … Read more