Home > Back-end >  For two dimensional array and all prime Numbers
For two dimensional array and all prime Numbers

Time:10-01

Using pointer and function

Example
1 2 3
4 5 6
7 8 9

17

CodePudding user response:

#include

Int main ()
{
Int arr [3] [3]={0};
Int I, j, sum=0;
For (I=0; I<3; I++)
{
For (j=0; J<3; J++)
{
The scanf (" % d ", & amp; A, [I] [j].
}
}

for(i=0; I & lt; 3; I++)
{
For (j=0; J<3; J++)
{
If (not a prime number)//- "to write their own judgment function of prime number
continue;
The else
The sum +=a, [I] [j].
}
}

Printf (" % d ", sum);

getchar();
return 0;
}

Write a judgment is roughly such a process, is a prime number of sub function,
  • Related