Prime numbers

How many prime numbers are there in between 1 to 100.


The answer is 25.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Prime numbers between 1-100 are as follows-2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89&97

Hà Vĩnh Đạt
Apr 5, 2014

Just run this program : "bool isPrime(int n) { if (n < 2) return false; for (int i = 2; i < n; i++) if (n % i == 0) return false; return true; } void main() { int c = 0; for (int i = 1; i <= 100; i++) if (isPrime(i)) c++; cout << c; } "

I also did the same. I wrote a C code to do that.

Aashish Patel
Mar 22, 2014

You can simply count the prime numbers by doing divisibility test.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...