Jump to content

Program in C


Recommended Posts

  • 5 months later...

Dupa cum ti s-a spus si in acest post, incearca sa ne arati ca te-ai chinuit putin cu rezolvarea la problema asta :)
Un numar este prim daca:

  • este pozitiv
  • are exact doi divizori pozitivi diferiti (1 si el insusi)

Pe scurt, pentru fiecare numar x de la 1 la 1000, poti testa sa vezi daca exista vreun alt numar din intervalul [2, x - 1] care sa il imparta pe x (mai exact x mod acel numar sa fie zero). Daca ai gasit cel putin un astfel de numar, numarul nu este prim. Daca nu, inseamna ca este.
Iar pentru cerinta a doua, un numar n este prim daca nu se imparte prin niciun numar prim din lista creata de tine anterior :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.