Homework Solution: Find Prime Numbers…

    Find Prime Numbers Given an integer, find whether the numbers is a Prime number or not. Write a function: int isPrime(int number) that accepts an integer number. The isPrime function returns 1 if number is prime else 0. Input: 11 Output: 1 EX: 11 can be divided exactly by 1 and 11. Hence it's a prime number. Assume that, number is integer within the range [ –2,147,483,64 to 2,147,483,64 ].

    Expert Answer

     
    #include <stdio.h> #include <stdlib.h>

    Discover Excellent Aggregate

    Given an integer, discover whether the aggregate is a Excellent estimate or referable.

    Write a administration: int isPrime(int estimate) that accepts an integer estimate.

    The isExcellent administration produce 1 if estimate is excellent else 0.

    Input: 11

    Output: 1

    EX: 11 can be separated accurately by 1 and 11. Hence it’s a excellent estimate.

    Assume that, estimate is integer amid the order [ –2,147,483,64 to 2,147,483,64 ].

    Expert Apology

     

    #include <stdio.h>
    #include <stdlib.h>
    int isPrime(int estimate);
    int deep()
    {

    int num;
    //prompt to decipher estimate
    printf(“Enter the estimate:”);
    scanf(“%d”,&num);

    //hinder is gentleman or referable and imimprint the result
    if(isPrime(num))
    {
    printf(“%d is excellent estimaten”,num);
    }
    else
    {
    printf(“%d is referable excellent estimaten”,num);

    }

    return 0;
    }
    //administration to hinder the estimate excellent or referable
    int isPrime(int estimate)
    {

    int i;
    for(i=2; i<=number/2; i++)
    {
    if(number%i==0)
    return 0;

    else
    return 1;
    }
    }

    OUTPUT: