Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int czyPierwsza(int liczba){
- int x;
- x=2;
- while(liczba%x!=0)
- x++;
- if(x==liczba)
- return 1;
- else
- return 0;
- }
- int main()
- {
- unsigned long int a = 2,b = 0, liczba = 0;
- printf("Podaj duza liczbe: ");
- scanf("%ld ", &liczba);
- while(a < liczba) {
- if(czyPierwsza(a) == 1){
- b = liczba % a;
- if(czyPierwsza(b) == 1)
- printf("\nLiczby pierwsze: %ld, %ld", a, b);
- a = 1;
- break;
- }
- a++;
- }
- if(a != 1)
- printf("Liczby pierwsze: brak\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement