Cod sursa(job #2032157)

Utilizator Andrei.GheorgheAndrei Gheorghe Andrei.Gheorghe Data 4 octombrie 2017 17:22:40
Problema Ciurul lui Eratosthenes Scor 20
Compilator cpp Status done
Runda Arhiva educationala Marime 0.49 kb
#include<fstream>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
    ifstream cin("ciur.in");
    ofstream cout("ciur.out");
    int a,b,v[100],i,j=0,k=0;
    cin>>a;
    for(i=2;i<=a;i++)
    {
        v[i]=i;
        if(v[i]>7)
        {
        if(v[i]%2!=0&&v[i]%3!=0&&v[i]%5!=0&&v[i]%7!=0)
        {
            k++;
        }
        }
        if(v[i]==2||v[i]==3||v[i]==5||v[i]==7)
        {
            k++;
        }
    }
    cout<<k;
}