Posts

Showing posts with the label Function

Fibonacci series using recursive function

Write a program using recursive to read positive number  and determine the fibonacci series of n terms C Program source code #include<stdio.h> #include<conio.h> int fibbo(int n1, int n2); int n ,no=1 ,temp; int main () { int n1=0,n2=1; printf("Enter number of terms in fibbonaccic series:"); scanf("%d",&n); printf("\n"); printf("fibbonaccic series of %d term are :\n" , n); printf("%d\t",n1); printf("%d\t",n2); fibbo(n1,n2); getch(); return 0 ; } int fibbo(int n1 , int n2) { if(no==n-1) return 0; temp = n1; n1=n2; n2 =n1+ temp; printf("%d\t",n2); no++; fibbo(n1,n2); } You can Browse related article below for more information and program code related to string function  Does above is helpful , Post you views in comment DO NOT MISS OTHER C PROGRAMMING TUTORIAL * indicates required Email Address * Fibonacci series using recursiv

Check prime number using recursive function

Check prime number using recursive function Write a program to Check prime number using recursive function #include <stdio.h> #include <conio.h> int n , e ,i ; int prime ( int n , int i) { if (n == 1 || n == 0 ) { return 2; } else { if (i == 1 ) return 0; else { if (n%i != 0){ prime(n , i-1); } else { return 1 ; } } } } int main () { printf("Input a number to check whether number is prime or not: "); scanf("%d" ,&n); e = prime ( n , n-1); if (e == 0 ) printf("\nThe supplied number is prime"); if (e == 1 ) printf("\nThe supplied number is not prime"); if (e == 2 ) printf("\nThe supplied number is neither prime nor not prime"); getch() ; return 0 ; } You can Browse related article below for more information and program code related to recursive function call  Does above is helpful , Post you views in comment DO NOT MISS OTHER C PROGRAMMING TUTORIAL * indicates requi