C program to find sum of series 1^2+3^2+5^2+…..+n^2

C program to find sum of series 1^2+3^2+5^2+.....+n^2

#include<stdio.h>
#include<conio.h>

void main()
{
int i,n,sum=0;
clrscr(); //to clear the screen

printf(“1^2+3^2+5^2+…..+n^2”);
printf(“nnEnter value of n:”);
scanf(“%d”,&n);

for(i=1;i<=n;i+=2)
sum+=i*i;
printf(“Sum=%d”,sum);
getch(); //to stop the screen
}

2 thoughts on “C program to find sum of series 1^2+3^2+5^2+…..+n^2”

  1. Write a c program which accepts a number and checks how that it is the direct product of how many numbers 64 = 2^6, 4^6, 8^2

Leave a Comment

Your email address will not be published. Required fields are marked *