+ 1

Problem in Code

How to write function in C to display prime number? This is my Code : #include <stdio.h> int prime (int num ){ printf("Enter num"); scanf("%d", &num);     int i ; for(i=2;i<=num/2;i++) { if(num%i!=0) continue; else return 1; } printf("prime num is = %d\n",prime(num)); return 0; }

24th Mar 2020, 10:29 PM
Rawan
Rawan - avatar
1 Réponse
+ 3
https://code.sololearn.com/cV8kOeyCQL6h/?ref=app I made it in java... Try understanding the algorithm!
26th Mar 2020, 6:43 PM
Ravi Mishra
Ravi Mishra - avatar