I am using C language UNIX I have to use Arry to do this pro

I am using C language, UNIX

I have to use Arry to do this problem..

Given fifteen integers as input identify any pair of neighboring digits in each number that make a prime number. Example Execution #1: Enter 15 integers now: 121 101 221 231 301 313 331 333 433 437 515 551 697 7315961 9007 Two-digit primes found within the data provided: 121: No primes found. 101: 01 221: No primes found. 231: 31 23 301: 01 313: 13 31 331: 31 333: No primes found. 433: 43 437: 37 43 515: No primes found. 551: No primes found. 697: 97 7315961: 61 59 31 73 9007: 07 Example Execution #2 (one and two are considered prime): Enter 15 integers now: 31 13 1 3 5 7 9 101 103 105 107 102 41 97 0 Two-digit primes found within the data provided: 31: 31 13: 13 1: No primes found. 3: No primes found. 5: No primes found. 7: No primes found. 9: No primes found. 101: 01 103: 03 105: 05 107: 07 102: 02 41: 41 97: 97 0: No primes found.

Solution

int[ ] nums = { } ;

Console.WriteLine( pick prime number from array \ \" ) ;

int j ;

for ( int i =0, i< nums.length ; i++ )

{

for ( j =2; j < nums[i]; j++ )

if ( ( nums[i] % j ==0) )

{

COnsole.Write ( \" {0} : IS NOT a primenumber \", + nums[i] ) ;

break;

}

if ( j == nums[i] )

{

Console.WrieLine ( \"{0} : Is a primenumbeR \" , +nums[i] ) ;break ;

}

if ( j== nums[ i ] )

{

Consolr.WriteLine( \"{0} : Is a primenumber\" , +nums[i] ) ;

}

}

I am using C language, UNIX I have to use Arry to do this problem.. Given fifteen integers as input identify any pair of neighboring digits in each number that

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site