Computer Science, asked by SusanAabidi8477, 9 months ago

Write a program in C++ to print the prime numbers between 100-200 using recursion

Answers

Answered by ambccbjcgh12
0

 #include<stdio.h>

 int prime(int, int);

 int main(){

        int numbr,k,remark=1;

        printf(" The prime numbers between 1 and 100 using recursion . . . \n");

        for(numbr=100;numbr<=200;++numbr)

        {

        remark = prime(numbr, numbr/2);

        if(remark==1)

        printf(" %d ",numbr);

        }

        return 0;

        }

 int prime(int num, int max){

        if(max == 1)

        return 1;

        else

        {

        if(num % max == 0)

        return 0;

        else

        prime(num, max-1);

        }

        }

Similar questions