This C program will let you know about “find the sum of squares of N natural numbers?”. This C source code is coming under the part of C beginners guide. Feel free to use this code or if you can just contribute as a program writer.
- C program for finding the Cube values of a Number
- How to get month name from month number – C program
SUM OF SQUARES OF N NUMBERS
Sum of squares of “n” numbers in c is used to find the square value of a number by using looping statement (for loop). It finds the power value of a given number and adds like wise. It is an easy and efficient way.
[Read: Software Company Details] & [Love % Calculator]
WRITE A C PROGRAM:
/* Title: Squares Value Author: Vinoth Selvaraj © http://students3k.com */ //Header files #include<stdio.h> #include<conio.h> #include<math.h> void main() { //Program variables int j,num,su=0; clrscr(); //Function to clear the previous output printf("Enter the value:"); //Display function scanf("%d",&num); //Getting input function for(j=1;j<=num;j++) //Looping statement { su+=pow(j,2); } printf("Sum of square = %d",su); getch(); }