Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int counter,j, num1, num_prime;
- printf ("Enter a number:\n");
- scanf ("%d", &num1);
- for (counter=2 ; counter <= num1 ; counter++){
- if (num1 % counter == 0){
- num_prime = 1 ;
- for ( j = 2 ; j <= counter/2 ; j++){
- if (counter % j == 0){
- num_prime = 0 ;
- break;
- }
- }
- if (num_prime == 1){
- printf("%d\n", counter);
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement