RELATED POSTS
- Blogger Comment
- Facebook Comment
Subscribe to:
Post Comments
(
Atom
)
C/C++,java,python c++ keywords, identifiers, data types,variables,modifiers,storage classes,operators,for loop ,while loop,do while loop,if else statement,nested loops,break continue goto statement,functions ,call by value call by reference ,arrays ,strings,pointers,data structures ,classes and objects,inheritance,polymorphism,operator overloading,function overloading,data abstraction,data encapsulation,dynamic memory allocation for array and objects,function templates,class templates,
Integer N
Prime numbers in different lines
1 <= N <= 100
9
2
3
5
7
20
2
3
5
7
11
13
17
19
C++ code :
#include <iostream>
using namespace std;
int main()
{
int number;
cin >> number;
for(int n = 2; n<=number; n++)
{
bool divided=false;
for(int i=2; i<n; i+=1)
{
if(n%i == 0)
{
divided = true;
break;
}
}
if(divided == false)
{
cout << n << endl;
}
}
}
RELATED POST:
0 comments:
Post a Comment