1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Orlov [11]
3 years ago
7

C program to generate prime numbers from 1 to 100.Also count prime numbers. ​

Mathematics
1 answer:
Musya8 [376]3 years ago
8 0

Answer:

Step-by-step explanation:

#include <stdio.h>

int main()

{

  int num1, num2, flag_var, i, j;

 

  /* Ask user to input the from/to range

   * like 1 to 100, 10 to 1000 etc.

   */

  printf("Enter two range(input integer numbers only):");

  //Store the range in variables using scanf

  scanf("%d %d", &num1, &num2);

 

  //Display prime numbers for input range

  printf("Prime numbers from %d and %d are:\n", num1, num2);

  for(i=num1+1; i<num2; ++i)

  {

     flag_var=0;

     for(j=2; j<=i/2; ++j)

     {

        if(i%j==0)

        {

           flag_var=1;

           break;

        }

     }

     if(flag_var==0)

        printf("%d\n",i);

 }

 return 0;

}

You might be interested in
Which three-dimensional figure has a cross section in the shape of a trapezoid if it is sliced by a plane that is parallel to a
Serhud [2]
The three-dimensional figure that will produce a trapezoid if its cross section was cut by a plane that is not parallel to its base is the rectangular pyramid. If a plane was cut parallel to the base of the pyramid, the shape that would be produced would be a rectangle.
5 0
3 years ago
Read 2 more answers
Which algebraic expression represents "the quotient of 7 and a number"?
bogdanovich [222]
7/n. quotient means division
6 0
4 years ago
Read 2 more answers
Find the area of a circle with radius, r = 7.29m. Give your answer rounded to 2 DP
maksim [4K]

Answer:

Area of a circle is πr²

where r is the radius

r = 7.29m

Area = π × 7.29²

= 166.957

= 166.96m² to 2 decimal places

Hope this helps you

5 0
3 years ago
Which digit in 123.456 has highest value?<br> Digit<br> 6<br><br> 5<br><br> 4<br> 1
Lubov Fominskaja [6]

<em>Which digit in 123.456 has highest value?</em>

<em>answer</em><em> </em><em>=</em><em> </em><em>1</em><em>.</em><em>.</em><em>.</em><em>.</em>

3 0
3 years ago
Read 2 more answers
Plssssssssss helpppppppp 2q'sssssssssssss
anastassius [24]

y=5×+630 that's question 1

the other question im not sure

4 0
3 years ago
Other questions:
  • Leticia wants to go on a band trip to New York for spring break. It cost $1200 per student the bndwill pay 25% of the cost for e
    15·1 answer
  • An arc is intercepted by a central angle of 3π2 radians on a circle with a radius of 18 centimeters.
    11·1 answer
  • If a boat travels 36 miles in 1.5 hours and then
    14·2 answers
  • 20 = 4z how do I solve this equation?
    12·2 answers
  • 2+22+10027+100(10000X5) divided by19999999999999w787w9w :)
    11·1 answer
  • What is the solution for in (3x-5)=in11+2?<br><br> a. x=8<br> b. x=9<br> c. x=-3<br> d. x=7
    15·1 answer
  • G(x) = -1/2x+k. If g(4)=11, what is the value of k?
    15·1 answer
  • HELP I NEED 8 DONE TODAY <br> btw this is a writing assignment
    9·1 answer
  • i’m tryna finish my exit ticket asap please i don’t need no links i just need help and the answer please
    7·1 answer
  • Look at this graph:
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!