Need help Prime numbers in Cartesian axis

FedericoGB25

New Coder
Oct 10, 2019
6
0
2
Hello everyone :)
I have written a program using C Language that prints all prime numbers using a loop.

I would like to print these numbers in a Cartesian axis. I have tried to include the library graphics.h, but I can't do it because it says me "File not found".
Is there another way to do it?

My code:
C:
#include <stdio.h>

int main () {
    int n, d;

    for(n=1;;n++) {
        for(d=2;d<=n/2;d++) {
            if(n%d==0) {
                break;
            }
        }
        if(n%d!=0) {
            printf("* %d\n" ,n);
        }
    }
}

Thanks a lot :)
 

swift

New Coder
Nov 11, 2019
9
3
3
A quick Google suggests to me that the library is not a standard library which is probably why you're getting the file not found error.

Given its age, people have previously suggested that you should try a library like SDL or GTK instead. There is a port of the original library called "WinBGIm" but that's also old so I don't know what kind of mileage you'll get out of it.

I can't pretend to know much about this so I'd say have a Google and take a look at StackOverflow for some more guidance - where it appears a very similar question was asked before.

Hope you manage to find a solution :thumbsup:
 

William

Active Coder
Sep 7, 2019
191
39
38
I have also did a quick search and have unfortunately returned with nothing...

When I did my quick search, I essentially just found the same results as @swift. <graphics.h> is not a Standard C Header. You can use a Library called 'WinBGIm' and that you should probably use a Library such as SDL or GTK(But I'd suggest making a couple basic Programs using those Libraries before making a SDL/GTK Program that involves a Cartesian-Axis).

i did try looking up online for how to do a Cartesian-Axis in C, but only got C Tutorials and results for what a Cartesian-Axis is(Note: Unlike @swift, I use Qwant instead of Google, so I will have gotten different results. Depending on you Search-Engine, you will also get different results. But, I suggest looking at what results you get and see if it relates to any of this).

Anyways, by the looks of it, you might be on your own for this one. I'm sorry that I couldn't help with this. Again, look deep into the search-results and see what you can find. If you decide to do it in SDL or GTK(+) then study them first before making an actual Program with them.

Good luck!