Question:<?php
$primes = array(2,3,5,7,11,13,17,19,23,29,31,37,41,43,47);
for($count = 1; $count++; $count < 1000) {
  $randomNumber = rand(1,50);

  if (in_array($randomNumber,$primes)){
    break;
  }else {
    printf("Non-prime number found: %d", $randomNumber);
  }
}
?>
Sample output follows: 

A Non-prime number found: 48 Non-prime number found: 42 Prime number found: 17 

B Non-prime number found: 48 Non-prime number found: 42 Prime number found: 00 

C 48 17 

D Non-prime number found Non-prime number found Prime number found 

+ Answer
+ Report
Total Preview: 1084

Copyright © 2024. Powered by Intellect Software Ltd