bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

prac_005.cpp (749B)


      1 /*
      2  * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 22 Jun 2026
      3  * Repo: https://github.com/notamitgamer/bsc
      4  * License: MIT
      5  */
      6 
      7 /* check prime or not */
      8 
      9 #include <iostream>
     10 using namespace std;
     11 
     12 class ponp {
     13     int input, i;
     14 
     15 public:
     16     void getinput();
     17     void calcdisp();
     18 };
     19 
     20 void ponp::getinput() {
     21     cout << "please enter the value : ";
     22     cin >> input;
     23 }
     24 
     25 void ponp::calcdisp() {
     26     if (input <= 1) {
     27         cout << "This is not a prime number.";
     28         return;
     29     }
     30 
     31     for (i = 2; i <= input / 2; i++) {
     32         if (input % i == 0) {
     33             cout << "this is not a prime number.";
     34             return;
     35         }
     36     }
     37     cout << "prime";
     38 }
     39 
     40 int main() {
     41     ponp z;
     42     z.getinput();
     43     z.calcdisp();
     44     return 0;
     45 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror