Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
419 B
8
Indexable
Never
#include <stdio.h>
#include <stdlib.h>


int main()
{
    int prime;
    int val = 131;
    prime = primo(val);
    if(prime == 0) printf("Il numero %d NON e' primo",val);
    else printf("Il numero %d e' primo",val);
    return 0;
}

int primo(unsigned int val)
{
    int i;
    for(i = 2; i < val;i++){
        if(val % i == 0)
        {
            return 0;
        }
    }
    return 1;
}