SHARE
TWEET

Untitled

a guest Apr 20th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4. void pierwsze( unsigned int n, unsigned int m)
  5. {
  6.     int i,j,z=0;
  7.     int w;
  8.     int tab[100];
  9.     int czy=0;
  10.     for(i = n; i<=m; i++)
  11.     {
  12.         for(j = 2; j<i; j++)
  13.         {
  14.             if(i%j == 0) w=1;
  15.             else w = 0;
  16.         }
  17.         if(w == 0)
  18.         {
  19.             tab[z]=i;
  20.             z++;
  21.         }
  22.  
  23.     }
  24.     printf("Liczby pierwsze z podanego przedzialu: ");
  25.     for(i=0; i!=100; i++)
  26.     {
  27.         printf("%d", tab[i]);
  28.     }
  29. }
  30.  
  31. int main(void)
  32. {
  33.     unsigned int n,m;
  34.     printf("Podaj przedzial: ");
  35.     scanf("%u", &n);
  36.     scanf("%u", &m);
  37.     pierwsze(m,n);
  38.     return 0;
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top