Created
May 10, 2021 08:40
-
-
Save jagdish4501/95567648459f40d2d51d37143f685434 to your computer and use it in GitHub Desktop.
Let us c Q.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* using recursion*/ | |
#include <stdio.h> | |
void prime(int); | |
int main() | |
{ | |
int num; | |
printf(" Enter a number "); | |
scanf("%d", &num); | |
prime(num); | |
} | |
void prime(int num) | |
{ | |
for (int a = 2; a <= num; a++) | |
{ | |
if (num % a == 0) | |
{ | |
printf("%d,", a); | |
prime(num / a); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment