Chapter:

Recursive-program-in-c

C Program to Find wher a Number is Prime or Not using Recursion

This is a C program to find whether a number is prime or not using recursion.

Problem Description

The following C program, using recursion, finds whether the entered number is a prime number or not.

Problem Solution

A prime number is an integer that has no integral factor but itself and 1.

Program/Source Code

#include <stdio.h>

 

int primeno(int, int);

 

int main()

{

    int num, check;

    printf("Enter a number: ");

    scanf("%d", &num);

    check = primeno(num, num / 2);

    if (check == 1)

    {

        printf("%d is a prime number\n", num);

    }

 &nb....Show More

All Chapters

View all Chapter and number of question available From each chapter from C-programming-