Find a range of composite numbers of given length | C ++ program to find a range of composite numbers of given length ; method to find factorial of given number ; to print range of length n having all composite integers ; Driver method
#include <bits/stdc++.h> NEW_LINE using namespace std ; int factorial ( int n ) { if ( n == 0 ) return 1 ; return n * factorial ( n - 1 ) ; } int printRange ( int n ) { int a = factorial ( n + 2 ) + 2 ; int b = a + n - 1 ; cout << " [ " << a << " , ▁ " << b << " ] " ; return 0 ; } int main ( ) { int n = 3 ; printRange ( n ) ; return 0 ; }