answersLogoWhite

0


Best Answer

class primenoSeries

{

void main ()

{

int i = 1; // Used to divide number and check if they are factors or not.

int C = 0; // used as a counter for number of factors.

int n = 1; // Represent the numbers.

while (n > 0)

{

if ( n % i n )

{

C = 0;

n++ ;

i = 1;

}// Check next number since previous number had more than two factors.

else

{

i++ ;

}

}

else

i++ ;

}

}

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to print prime numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a C Program to print sum of squares of odd numbers?

#include


How do you write a program in objective c numbers 1-100 prime numbers?

fdsgfhgdfhgdf


How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


Print first ten prime numbers in c?

// simple program to generate first ten prime numbers #include<stdio.h> #include<conio.h> void main() { int c,i,j,n; clrscr(); for(i=2;i<30;i++) { c=0; for(j=2;j<i;j++) { if(i%j==0) {c=c+1; } } if(c==0) printf("%d",i); } getch(); }


Write a C program to find the sum of all prime numbers?

Since there is an infinite set of prime numbers the answer would be infinity.


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


Write a c program to print prime numbers from 1 to 10000 that has an unit digit which is multiple of 3?

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


Write a java script program to print first ten odd natural numbers in C?

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?

Write a c program to print the 100 to 1 nos


Write a C program to find the prime numbers from 1 to 300?

/*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); } } }


How do you write a c program to get a range from user and give a list of prime numbers?

To get all tutorials of "c programming" Reference:cprogramming-bd.com/c_page2.aspx# prime number


C program to print numbers 1 to n?

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