Board index » Visual Studio » Can onyone help me?
|
herb1962
|
Can onyone help me?
Visual Studio97
Whats wrong with this code? It's supposed to count the prime's in a k elements duratio It'a an DOS c++... #include <stdio.h> #include <conio.h> #include <math.h> float a[100]; int k, ilosc, i, z; main() { clrscr(); z=2; printf("\n\n\tPodaj dlugosc ciagu k: "); scanf("%d", &k); for (i=0; i<k; i++) scanf("%f",&a[i]); while (a[i]<=sqrt(z)) {if (a[i] % z =0) z=z+1 else ilosc++ } printf("\n\n\tilosc liczb pierwszych wynosi: ",ilosc); getch(); return(0); } - |
