Facebook
From wojtek, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 380
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5.  
  6. int main()
  7. {
  8.     srand( time( NULL ) );
  9.     int counter = 0;
  10.     int Number = (std::rand() % 146) + 5;
  11.     std::cout << Number << std::endl;
  12.     for(int i=1; i<=Number; i++){
  13.  
  14.         if(Number % i == 0 ){
  15.             std::cout << "Divisor of the Number is:" << i << std::endl;
  16.             counter ++;
  17.         }
  18.  
  19.     }
  20.     std::cout << "The Quantity of Divisors is:" << counter << std::endl;
  21.     if(counter == 2){
  22.         std::cout << "THIS IS A PRIME NUMBER!";
  23.     }
  24.     return 0;
  25. }
  26.  

Replies to x rss

Title Name Language When
Re: x wojtek text 6 Years ago.