C Program to Find the Sum of Natural Numbers using Recursion C Program to Find Factorial of a Number Using Recursion C Program to Find G.C.D Using Recursion C Program to Convert Binary Number to Decimal and vice-versa C Program to Convert Octal Number to Decimal and vice-versa ...
f=calculate_fact(n); // calling a function printf("factorial of a number is %d",f); return 0; } int calculate_fact(int a) { if(a==1) { return 1; } else return a*calculate_fact(a-1); //calling a function recursively. } Output:factorial...
/* C program to find largest number using if statement only */ #include <stdio.h> int main(){ float a, b, c; printf("Enter three numbers: "); scanf("%f %f %f", &a, &b, &c); if(a>=b && a>=c) printf("Largest number = %.2f", a); if(b>=a && b>=c) printf("L...
RUN 1: Enter the value of N: 100 Sum is: 5050 RUN 2: Enter the value of N: 10 Sum is: 55 RUn 3: Enter the value of N: 3 Sum is: 6 C Looping Programs » C Program to find factorial of a number C program to print all prime numbers from 1 to N ...
Factorial of a Number using Recursion Find LCM Of A Number Using Recursion Find GCD Of The Given Numbers Using Recursion Product of 2 Numbers using Recursion Why learn C language? C language is a great language to introduce yourself to the programming world because it is simple, and easy to...
C Program to find the factorial of a number C Program to find Armstrong numbers C Program to find Prime Numbers C Program to generate Fibonacci sequence C Program to find the sum of the digits of a number untill the sum is reduced to a single digit C Program to count number of digits...
C program to calculate power of a number using recursion C program to find sum of all digits using recursion Related Programs C program to read a value and print its corresponding percentage from 1% to 100% using recursion C program to find factorial using recursion ...
int fac (int n) { if (n < 0) return -1; //n must be positive if (n <= 1) return 1; return n * fac (n-1); } n <= 1 will be the condition to exit our recursion. Let's say n is 3. We get 3 * fac (2), but 2 is also bigger than one, so we get 3 * 2 ...
C Program – to Check Whether a Number is Even or Odd C Program – to compute the area and perimeter of a rectangle C Program – that converts Centigrade to Fahrenheit. C Program – to Count number of digits in number without using mod operator ...
C For Loop FlowchartC For Loop SyntaxProgram-1: Program to find the factorial of a numberFlowchart:Algorithm:Code:Program-2: Program to find all numbers between 1 to 100 divisible by 4Flowchart:Algorithm:Code: C For Loop for Beginners In our previous tutorial, we learned the functioning of ...