Function types

Description:

No arguments passed and no return value Test Case 1 Input (stdin) 5 Expected Output 5 is a prime Test Case 2 Input (stdin) 4 Expected Output 4 is not a prime

Program :

#include <iostream>

using namespace std;

int main(){

   int num;

   bool flag = true;

   cin>>num;

   for(int i = 2; i <= num / 2; i++) {

      if(num % i == 0) {

         flag = false;

         break;

      }}

   if (flag==true)

      cout<<num<<" is a prime";

   else

      cout<<num<<" is not a prime";

   return 0;

}