Best Answer

#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();

}

Q: Program to print prime numbers between 1 to100?

Write your answer...

Submit

Still have questions?

Continue Learning about Math & Arithmetic

Prime numbers are numbers that are only divisible by themselves and the number 1. You can write a program to print all prime numbers from 1 to 100 in FoxPro.

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.

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

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

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.

Related questions

Prime numbers are numbers that are only divisible by themselves and the number 1. You can write a program to print all prime numbers from 1 to 100 in FoxPro.

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.

PRINT 2,3,5,7,11,13,17,19,23,29,31,37

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

Use a counted loop in the closed range [1:100]. If the count is in the closed range [40:50], print the number. For all other numbers outwith this range, only print the number if it is prime.

First, create a for loop from a,1 to 50. Inside of that create another for loop b,2 to a-1. If a/b=int(a/b) then you know it is not prime

Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.

Write a c program to print the 100 to 1 nos

/*the program to print prime no from 1 to 300*/ #include<stdio.h> #include<conio.h> void main() { int i,j; clrscr(); printf("The prime numbers from 1 to 300 are\n"); for(j=2;j<=300;j++) { for(i=2;i<=j/2;i++) if(j%i==0) break; if(i>j/2) { printf("%d ",j); } } }

for (int i = 2; i < 10; i ++) printf("%d\n", i); You did say even and odd numbers between 1 and 10. That's allnumbers between 1 and 10.

how do we use loops in c plus plus programing and what are basic differences between do,for and while loop

This is a homework question and does not deserve an answer because you will learn nothing other than being lazy.