+ 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"); }

14th Aug 2020, 5:49 AM
narthana wickramasinghe
narthana wickramasinghe - avatar
2 ответов
0
Thank you so much
14th Aug 2020, 7:45 AM
narthana wickramasinghe
narthana wickramasinghe - avatar