+ 1
This is the c program to find prime numbers in array it also doesnt work properly 😢😢😢😢😢
#include<stdio.h> int main() { int n,i,j,prime; printf("enter how many numbers you wish to add:\n"); scanf("%d",&n); int x[n]; for(i=0;i<n;i++) { printf("enter no %d:\n",i+1); scanf("%d",&x[n]); } printf("prime numbers are in the given array :\n"); for(i=0;i<n;i++) { int k=x[i]; for(j=2;j<k/2;j++) { if(k%j==0) { int prime=0; break; } } if(prime==1) printf("%d",k); } printf("\n"); }
2 Réponses
0
Thank you so much