Skip to content

Instantly share code, notes, and snippets.

@m-f-h
m-f-h / findNextPrime
Last active February 4, 2022 19:57 — forked from alabombarda/findNextPrime
A simple program in C++ that finds the next prime number above a given number.
// findNextPrime.cpp - return the next larger prime number
// (input taken from command line args or from stdin)
#include <iostream>
int findNextPrime(int n); // given a number n, find the next larger prime number above n
bool isPrime(int n); // given a number n, determine whether it is prime
int main(int argc, char**argv)
{
int input;