answersLogoWhite

0

#include<iostream>

bool is_prime (const unsigned num) {

return num%2 && num%3 && num%5 && num%7;

}

int main() {

for (unsigned num=11; num<=100; ++num)

if (is_prime (num))

std::cout<<num<<std::endl;

}

Output:

13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

User Avatar

Wiki User

10y ago

What else can I help you with?

Related Questions

How many pages are required to print large prime number?

An infinite number of pages are required to print an infinitely large prime number.


How can print prime numbers in between 1-100 but not adjust 40-50 in php language?

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.


Prints the 1000th prime number?

// Print prime number series. class prime { void main () { int i = 1; int C = 0; int n = 1; int X = 0; while (X != 1000) { if ( n % i n ) { C = 0; n++ ; i = 0; } } i++ ; } } }


How do you print non-prime numbers in java?

Loop through some numbers - for example, 2 through 100 - and check each one whether it is a prime number (write a second loop to test whether it is divisible by any number between 2 and the number minus 1). If, in this second loop, you find a factor that is greater than 1 and less than the number, it is not a prime, and you can print it out.


The fraction that appears in the center of a print below the image is referred to as the number?

series number


How do you check a prime number in qbasic?

Cls input "enter the no. You want to check", a if a &lt;=0 then print "only natural nos allowed" if a &lt;=0 end let m = a - 1 for i = m to 2 step -1 if a mod i = 0 then print "not prime" if a mod i = 0 then end next i print "prime" end


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.


How do you find prime no in gwbasic program?

10 input "enter a no."; n 20 for i = 1 to n 30 if n mod i = 0 then c = c +1 40 next i 50 if c = 2 then print "prime number" else print "not a prime number" 60 end


Python function that lists prime numbers?

If you just want a hint: One way to check whether a number is prime is by dividing it by any number between 2 and the square root of your number. If the number divides by any of these, it is not prime. If you want the code: import math for num in range(1,101): if all(num%i!=0 for i in range(2,int(math.sqrt(num))+1)): print num


How can you Write a suitable pseudo code to check whether a number is prime or not?

Begin Read num for(i=2; i&lt;num; i++) if(num%2==0) then print "the number is not a prime no."; else if print "the number is prime"; end if Stop


Write a program to find prime number in vb net?

Private Sub Command1_Click() Dim I, N As Integer N = Val(Text1.Text) For I = 2 To N - 1 If N Mod I = 0 Then Print "THE NUMBER IS NOT A PRIME NUMBER" Exit Sub End If Next I Print "THE NUMBER IS A PRIME NUMBER" End Sub Private Sub Command2_Click() Text1.Text = "" Text1.SetFocus End Sub Private Sub Command3_Click() End End Sub


How do you solve this program wap to print sum of a digit of an inputed number?

wap to print all the arnstrong no. between 100&amp;1000