Cod sursa(job #1570374)
| Utilizator | Data | 16 ianuarie 2016 14:27:48 | |
|---|---|---|---|
| Problema | Generare de permutari | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.51 kb |
#include <iostream>
using namespace std;
int a, b, i, j, gasit;
void citire()
{
cout << "a= ";cin >> a;
cout << "b= ";cin >> b;
}
void numere_prime()
{
for(i=a;i<=b;i++)
{
gasit = 0;
if((i%2==0)&&(i!=2)) gasit = 1;
else
{
for(j=3;j<=i/2;j+=2)
{
if(i%j==0) gasit = 1;
}
}
if(gasit==0) cout << i << " ";
}
}
int main()
{
citire();
numere_prime();
return 0;
}
