Question

You are to create a program that queries the user for a range of integer values...

You are to create a program that queries the user for a range of integer values (min and max). For this range, you are to find all of the prime numbers and print them to the screen. The user is then given the option to request that all of the non-prime numbers be printed to the screen with at least one factor pair that proves that they are not prime. (Using language C)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<stdio.h>

#include<conio.h>

int main()

{

int i,n;

int max,min;

printf(“enter the min_values”);

scanf(“%d”,&min);

printf(“enter the max_values”);

scanf(“%d”,&max_values);

for(n=min+1;n<max;n++)

{

int prime;

count=0;

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

{

if(n%i==0)

{

count++;

break;

}

if(count==0&&n!=1)

{

printf(“prime numbers are”);

}

else

{

printf(“nonprime numbers are”);

}

return 0;

}


answered by: ANURANJAN SARSAM
Add a comment
Know the answer?
Add Answer to:
You are to create a program that queries the user for a range of integer values...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • IN JAVA 1. Create a program that prompts the user for an integer and then displays...

    IN JAVA 1. Create a program that prompts the user for an integer and then displays a message indicating whether or not the number is a perfect square. This can be determined by finding the square root of a number, truncating it (by casting the double result), and then squaring that result 2. Write a program that prompts the user for two numbers. The first number is a minimum value and the second number is a maximum value. RandomNum then...

  • Write a program which will take a list of integer number from the user as input...

    Write a program which will take a list of integer number from the user as input and find the maximum and minimum number from the list. First, ask the user for the size of the array and then populate the array. Create a user define function for finding the minimum and maximum numbers. You have to use pointer variables for solving the problem. Finally, you need to print the entire list along with the max and min numbers ALSO NEED:...

  • Write a java program that will print if n numbers that the user will input are...

    Write a java program that will print if n numbers that the user will input are or not within a range of numbers. For that, your program needs to ask first for an integer number called N that will represent the number of times that will ask for other integer numbers. Right after, it should ask for two numbers that will represent the Min and Max for a range. Lastly. it will iterate N number times asking for an integer...

  • Instructions We're going to create a program which will allow the user to add values to a list, p...

    Instructions We're going to create a program which will allow the user to add values to a list, print the values, and print the sum of all the values. Part of this program will be a simple user interface. 1. In the Program class, add a static list of doubles: private statie List<double> _values new List<double>) this is the list of doubles well be working with in the program. 2. Add ReadInteger (string prompt) , and ReadDouble(string prompt) to the...

  • USING PYTHON 1. Write a small program that asks for an integer number from the user...

    USING PYTHON 1. Write a small program that asks for an integer number from the user and print all the prime numbers (2,3,5,7,etc) less than the input number. 2. How long it takes for your program to print the prime numbers less than 100. (Use magic functions)

  • PLs someone pls help me by editing my code to calculate the 4 pair of range to calculate the prim...

    PLs someone pls help me by editing my code to calculate the 4 pair of range to calculate the prime numbers by using web workers(You will have to use 4 workers). (I already have the code to manipulate the prime numbers but I need your help with web worker part)(code is below) Can someone pls help with the code of computing prime number for four pair of an integer values by using web worker concept ! Appreciate all the effort!...

  • THE PROGRAMMING LANGUAGE IS C++ Part 1.Create a program that decides whether a given integer is...

    THE PROGRAMMING LANGUAGE IS C++ Part 1.Create a program that decides whether a given integer is prime or not. The program should at the end of its analysis print the number followed by prime or composite. Part 2.Make the program from part 1 print the prime factors of any composite number entered (an additional feature to Part 1). THE PROGRAMMING LANGUAGE IS C++

  • Python 3.7 to be used. Just a simple design a program that depends on its own. You should also not need to import anythi...

    Python 3.7 to be used. Just a simple design a program that depends on its own. You should also not need to import anything. No code outside of a function! Median List Traversal and Exception Handling Create a menu-driven program that will accept a collection of non-negative integers from the keyboard, calculate the mean and median values and display those values on the screen. Your menu should have 6 options 50% below 50% above Add a number to the list/array...

  • I need help with this in C++ Program 2) Display and sum up all the numbers...

    I need help with this in C++ Program 2) Display and sum up all the numbers of factor of 5 in a given range. a) Request a number range (min/max values) separated by a space. b) Use a validation loop to ensure that both max and min are integers and max is greater than min. c) Output all the numbers of factor of 5 between the max and min. d) Output the sum of all the displayed numbers. e) Output...

  • Write a Java program that inputs a list of integer values in the range of −...

    Write a Java program that inputs a list of integer values in the range of − 1 to 100 from the keyboard and computes the sum of the squares of the input values. This program must use exception handling to ensure that the input values are in range and are legal integers, to handle the error of the sum of the squares becoming larger than a standard Integer variable can store, and to detect end-of-file and use it to cause...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT