Jak to naprawić aby działało
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
int i, j, zakres, b;
bool tablica [100];
cout << "Podaj gorny zakres, max99" <<endl;
cin >> zakres;
b = sqrt((float)zakres);
for (i=2; i<zakres+1; i++)
tablica[i] = true; //(1)
for (i=2; i<=b; i++)
if (tablica[i]!=false)
for (j=i+i; j<zakres+1; j=j+i)
tablica[j] = false; //(2)
cout << "Liczba pierwsza z zakresu od 1 do " << zakres << "to:" << end1;
for (i=2; i<zakres+1; i++)
if (tablica[i]!=false) //(3)
cout << i << " ";
cin.ignore();
getchar();
return 0;
}
" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2025 KUDO.TIPS - All rights reserved.
literówke miales/as
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
int i, j, zakres, b;
bool tablica [100];
cout << "Podaj gorny zakres, max99" <<endl;
cin >> zakres;
b = sqrt((float)zakres);
for (i=2; i<zakres+1; i++)
tablica[i] = true; //(1)
for (i=2; i<=b; i++)
if (tablica[i]!=false)
for (j=i+i; j<zakres+1; j=j+i)
tablica[j] = false; //(2)
cout << "Liczba pierwsza z zakresu od 1 do " << zakres << " to:" << endl;
for (i=2; i<zakres+1; i++)
if (tablica[i]!=false) //(3)
cout << i << " ";
cin.ignore();
getchar();
return 0;
}