#include <iostream>
      using namespace std;
      int main()
      {
          int i,n = 13;
          bool isprime= true;
          // 0 and 1 are not prime numbers also, negative numbers are not prime
          if(n < 2)
          {
              isprime = false;
          }
          else
          {
              for(i=2;i < n;i++)
              {
                  if(n % i == 0)
                  {
                      isprime = false;
                      break;
                  }
              }
          }
          string result = isprime ? "Prime" : "not Prime";
          cout<<"The number " << n << " is : " << result;
          return 0;
      }
      
      Cpp language logo

      Rxta

      0

      0

      avatar
      Yatharth Garg

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.