check if integer modulus js code example

Example 1: Write a function to check if a number is prime?

#include <stdio.h>
int main() {
    int n, i, flag = 0;
    printf("Enter a positive integer: ");
    scanf("%d", &n);

    for (i = 2; i <= n / 2; ++i) {

        // condition for non-prime
        if (n % i == 0) {
            flag = 1;
            break;
        }
    }

    if (n == 1) {
        printf("1 is neither prime nor composite.");
    }
    else {
        if (flag == 0)
            printf("%d is a prime number.", n);
        else
            printf("%d is not a prime number.", n);
    }

    return 0;
}

Example 2: javascript check if a value is an int

// The Number.isInteger() checks to see if the passed value is an integer
// Returns true or false

Number.isInteger(2); //True
Number.isInteger(90); //True
Number.isInteger("37"); //False
Number.isInteger(false); //false

Example 3: how to check if an integer is in array c#

//Add necessary namespace
using System.Linq;
//Example
string[] printer = {"jupiter", "neptune", "pangea", "mercury", "sonic"};
//using .Contains() method
if(printer.Contains("jupiter"))
{
    Process.Start("BLAH BLAH CODE TO ADD PRINTER VIA WINDOWS EXEC"");
}