Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int szam, oszto, a,i;
  7.     a = 0;
  8.     scanf("%d", &szam);
  9.     for(i = 1; i < szam; i++)
  10.     {
  11.         for(oszto = 2; oszto < i; oszto++)
  12.         {
  13.             if (i%oszto == 0)
  14.             {
  15.                 // printf("%d\n", oszto);
  16.                 a++;
  17.             }
  18.  
  19.         }
  20.         if(a==0)
  21.         {
  22.             printf("Az %d egy primszam\n", i);
  23.         }
  24.         a = 0;
  25.     }
  26.     //printf("%d\n",a);
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement