# 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 ].

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

Discover First-rate Gum

Given an integer, discover whether the gum is a First-rate calculate or referable.

Write a business: int isPrime(int calculate) that accepts an integer calculate.

The isFirst-rate business profits 1 if calculate is first-rate else 0.

Input: 11

Output: 1

EX: 11 can be disconnected precisely by 1 and 11. Hence it’s a first-rate calculate.

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

## Expert Response

#include <stdio.h>
#include <stdlib.h>
int isPrime(int calculate);
int main()
{

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

//bridle is gentleman or referable and print the result
if(isPrime(num))
{
printf(“%d is first-rate calculaten”,num);
}
else
{
printf(“%d is referable first-rate calculaten”,num);

}

return 0;
}
//business to bridle the calculate first-rate or referable
int isPrime(int calculate)
{

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

else
return 1;
}
}

OUTPUT: