How to write a C Program Finding the sum of Squares using Recursion in C Programming Language ?
Solution For C Program :
#include<stdio.h>
void main()
{
int square(int);
int n;
printf("\nEnter N'th Value : ");
scanf("%d", &n);
printf("\nThe Result is : %d.", square(n));
}
int square(int x)
{
int a, b;
if(x == 0) return 0;
if(x == 1) return 1;
a = x - 1;
b = x * x + square(a);
return(b);
}
You may also learn these C Program/Code :
C Program To Swap Two Numbers Without Using Third Variable
Learn More :
Sum
- Write the procedure , which is one of a sum , a product and a geometric average in the panel for the NxM elements are located on opposite diagonal and main diagonal . Remind ! Counting only odd elements !
- C Program To Find Sum and Difference Of Two Matrices
- C Program To Print Sum Of n Digit Number
- Give me an integer and I will sum it with the previous natural numbers
- C Program to Sum of The First and Last Digit Of 'n' Digit Number
- C Program to Sum of First and Last Digits of a Four-Digit number
- C Program to Sum of digits of a Five Digit Number
- C Program to Sum Up Digits Of A Number
- C Program to calculate the sum of elements of upper triangle of a n*n matrix using DMA
- Calculate sum of element of upper triangle of m*n matrix by using dynamic memory allocation
- Calculate sum of non-diagonal element in m*n matrix C Program
- Calculate sum of element of lower triangle of m*n matrix by using dynamic memory allocation
- Menu Driven Program to Read Two Integers Find Sum, Difference and Product C Program
- Input Number and Calculate Sum of it's Digits C Program
Find
- Find out the perfect number using c program
- Find g.c.d of two number using c program.
- Write a c program to find out NCR factor of given number
- How to Write a C program to find maximum between two numbers ?
- Write a C program to find maximum between three numbers ?
- C or C++ program to read marks of 4 subjects and find how many students are pass and fail with division
- C Program turnLEDOn to Drives Forward Until It Finds The Line
- Write overloaded function templates for finding the roots of the linear (a * x + b = 0) and square (a * x2 + b * x + c = 0) uravneniy.Zamechanie: in function to send coefficients of the equations.
- C Program to Find Random Number
- C Program To Find LCM and HCF Of Two Number Using Function - 2
- C Program to find LCM and HCF Of Two Number Using Recursion - 3
- C Program To Find LCM and HCF Of Two Number -1
- C Program To Find Length Of A String Including Blank Spaces, Tabs, And Other Special Characters
- C Program To Find Length Of String And Concatenate Two Strings
- C Program To Find Product Of Two No Using MACRO
- C Program To Find Reverse Of Any Digit Number
- C Program To Find Sum and Difference Of Two Matrices
- C Program To Find The Frequency Of A Number
- C Program To Find The Length, Reverse Of A String And To Check It Is Palindrome or Not
- C Program To Find The Maximum And Minimum Value In An Array
- C Program To Find Transpose Of A Matrix
- C Program To Find Union & Intersection Of Two Array
- C Program to Find NCR Of A Given Number Program
- C Program To Find Maximum Of Given Numbers
Recursion
- C Program Recursion Example
- C Program to find LCM and HCF Of Two Number Using Recursion - 3
- C Program To Generating Fibonacci Series Using Recursion
- C Program To Convert Decimal To Binary Using Recursion
- C Program to Calculate GCD using recursion
- C Program To Calculate First Numbers Using Recursion
- Factorial Program In C Using Recursion