answersLogoWhite

0

#include


void main()


{


int i, prime, lim_up, lim_low, n;


clrscr();


printf(“\n\n\t ENTER THE LOWER LIMIT…: “);


scanf(“%d”, &lim_low);


printf(“\n\n\t ENTER THE UPPER LIMIT…: “);


scanf(“%d”, &lim_up);


printf(“\n\n\t PRIME NUMBERS ARE…: “);


for(n=lim_low+1; n


{


prime = 1;


for(i=2; i


if(n%i == 0)


{


prime = 0;


break;


}


if(prime)


printf(“\n\n\t\t\t%d”, n);


}


getch();


}

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

ViviVivi
Your ride-or-die bestie who's seen you through every high and low.
Chat with Vivi
JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
RafaRafa
There's no fun in playing it safe. Why not try something a little unhinged?
Chat with Rafa

Add your answer:

Earn +20 pts
Q: Program to print prime numbers between 1 to100?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

Q2 Write a program to print even numbers between 10 and 50?

You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.


Program for print prime all number from 1 to 100 in foxpro?

Oh, what a lovely request! In FoxPro, you can create a program to print all prime numbers from 1 to 100 by using a loop to check each number for divisibility only by 1 and itself. If it meets this criteria, you can print it out on the screen. Remember, every number is unique and special, just like a happy little tree in a vast forest.


Write a program to print first 100 alternative prime numbers?

This would require some computer knowledge. It can make it easier to find out the prime numbers without figuring it out in your head.


How do you write a program to print prime numbers from 1 to 50 in PHP?

The following PHP Code will display the prime numbers between 2 and 50.You know that 1 is not a prime number so edit the value for "first for loop" according to your requirements (you can also do it for 2 to 1000 or from 900 to 929)Output will be:2is a prime number3is a prime number5is a prime number7is a prime number11is a prime number13is a prime number17is a prime number19is a prime number23is a prime number29is a prime number31is a prime number37is a prime number41is a prime number43is a prime number47is a prime number2013-02-22: Replaced $i/2 with sqrt($i) for efficiency by Ryankirgan


How do you write a program to twin print prime numbers from 1 to 50 in PHP?

I suggest you write an outer loop, that loops through all the numbers from 1 to 50. Call the variable that controls the loop something like "number".Then, initially assume the number is a prime (with a variable such as "isprime"); and write another loop that compares whether the number is divisible by any number from 2 to number-1. Call the controlling variable "factor". If number is divisible by factor, then it is not a prime, and you can exit the loop. At the end of the inner loop, if the variable "isprime" is still true, then you print the number.