Write a program in C++ to print the prime numbers between 100-200 using recursion
Answers
Answered by
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
Math,
5 months ago
India Languages,
5 months ago
English,
10 months ago
History,
10 months ago
Economy,
1 year ago