0
PLEASE SOLVE THIS ONE . BUT YOU CAN ONLY USE THE CONCEPTS OF IF-ELSE , LOOPS AND FUNCTION. DONT USE POINTERS ARRAYS OR RECURSION
10 Respostas
+ 4
Sir Jayakrishna🇮🇳 has explained well but still I wanna share it cuz I've made it:
https://code.sololearn.com/cyyWiVF9iU2M/?ref=app
+ 4
You missed semicolon in line 7 at end.
Remove line 17. Loop start from 1.
If you are looking a prime factors only then you need to find I is prime or n o t before printing.
+ 2
Jayakrishna🇮🇳
Man I have not completed the code because I don't further or i'm just exhausted . please provide me the solution.
+ 2
#include <stdio.h>
void factors(int);
int main() {
int num;
printf("enter the positive integer: \n");
scanf("%d",&num);
factors(num);
return 0;
}
void factors (int num){
int i;
for(i=1;i<=num;i++){
if(num%i==0) {
//for(j=2;j<=i;j++)
printf ("%d ",i);
}
}
// a prime number is a number which have only factors 1 and itself. implement this to function, and replace like:
if( isprime(i) )
printf("%d", I);
+ 2
Jayakrishna🇮🇳 sir i want you to be my mentor as well. Could you guide me through this programming journey?
+ 2
Snehil Pandey dont use another preprosessor directive, i have only studied if else , loops, and function.
+ 2
Snehil Pandey
thank you very much
+ 1
21C47 Ashish Raj check again it's edited
+ 1
Great
+ 1
Great, thanks.