Skip to content

Instantly share code, notes, and snippets.

@fgodino
Created October 29, 2013 08:34
Show Gist options
  • Save fgodino/7210967 to your computer and use it in GitHub Desktop.
Save fgodino/7210967 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cstdlib>
#include <math.h>
int main(){
int B=2, C=2, D=0, I=0, E;
printf("Hasta que Numero Quiere que Calcule Los Numeros Primos: "); scanf("%d",&E);
for(B;B<=E;B++){
C=2;
while((C<=B) && (B%C!=0)){
C++;}
if(B==C){printf("%6d",C); D++; I++; if(D==10){printf("n");D=0;}}
}
printf("nTotaL D NuMeRoS pRiMoS eS D: %dn",I);
system("PAUSE");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment