Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- #include <locale.h>
- #include <stdlib.h>
- int main(){
- int i,j,n,m,test = 0,count = 0,o;
- int b[count];
- printf("N = ");
- scanf("%d",&n);
- printf("M = ");
- scanf("%d",&m);
- int arr[n][m];
- srand(time(NULL));
- for(i = 0;i<n;i++){
- for(j = 0;j<m;j++){
- arr[i][j] = rand() % 100;
- printf("%d ",arr[i][j]);
- }
- printf("\n");
- }
- for(i = 0;i<n;i++){
- for(j = 0;j<m;j++){
- for(o = 2;o<arr[i][j];o++){
- if(arr[i][j]%o == 0){
- printf("%d - %d\n",arr[i][j],o);
- test = 1;
- break;
- } else {
- test = 0;
- }
- }
- if(test == 0){
- count++;
- b[count-1] = arr[i][j];
- }
- }
- }
- for(i = 0;i<count;i++){
- printf("%d ",b[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement