#include <stdbool.h>
      
      bool isPrime(int value);
      
      bool isPrime(int value){
        int i, aux = 0;
      
        for (i = 1; i < value;){
          if (value % i == 0)
            aux++;
      
          if (aux > 1)
            return 0;
      
          i += 2;
        }
      
        return (aux == 1) ? 1 : 0;
      }
      
      C language logo

      .funcisPrime

      0

      1

      avatar
      pZacca
      C code-speeding snippets

      The function isPrime() checks whether a number is prime by dividing it by itself a specified number of times. If the result is not zero, the number is prime.

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.