Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. /*Nombre: primos.c
  2. Sinopsis: calcula los primos entre 1 y 100.
  3. Comentario extra: menudo zurullo de codigo de mis pelotas.
  4. Autor: yo, que soy to prah (Víctor).*/
  5.  
  6. #include<stdio.h>
  7.  
  8. int resto, numero,i,primo;
  9.  
  10. int main(){
  11. for(numero=1;numero<=100;numero++){
  12.   primo=1;
  13.   for(i=(numero-1);i>1;i--){
  14.     resto=(numero%i);
  15.     if(resto==0){
  16.       primo=0;
  17.       break;
  18.     }
  19.   }  
  20.   if (primo==1)
  21.   printf("%d es primo\n",numero);
  22. }
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement