answersLogoWhite

0


Best Answer

#include<stdio.h>

int main()

{

int count,i,j,k,n,*a,sum=0;

printf("Enter the value of 'n':");

scanf("%d",&n);

a=malloc(n*sizeof(int));

for(i=1;i<=n;i++)

{

count=0;

j=1;

while(j<=i)

{

if(i%j==0 && i!=2)

count++;

j++;

}

if(count==2 count==1)

{

for(k=0;k<=n;k++)

a[k]=i;

}

}

for(k=0;k<=n;k=k+1)

printf("%d\t",a[k]);

for(k=0;k<=n;k=k+2)

sum+=a[k] * a[k];

printf("The sum of squares of alternative prime numbers is=%d",sum);

getchar();

return 0;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

#include<stdio.h>

#include<conio.h>

void main()

{

int sum_sqr(int n);

clrscr();

printf("%d",sum_sqr(5));//Sum of first 5 natural numbers' square values

getch();

}

int sum_sqr(int n)

{

int i,sum=0;

for(i=1;i<=n;i++)

{

sum=sum+(i*i);

}

return sum;

}

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Algorithm and Flowcharts for a program to compute the sum of the squares of the numbers for a given range used for loop

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to find the sum of squares of the given number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a c program to find given number is prime or not?

Yes, do write, or if you're too lazy to your homework, use google.


Could you write a assembly language program in tasm To check whether a given number present in a sequence of given memory location containing the string to be checked in 8086?

8086 assembly language program to check wether given number is perfect or not


Write a C program to extract a given word from a file?

program to extract a given word from a file


Lab manual in mca 1st sem from ignou?

write a program in C to check whether a given number is apalindrome or not


How can you write a program specification for a given report?

It is your face


Write a C program called MonthDays to find the number of days in a given month Test your code with different input values to demonstrate that your function is robust?

Write a C program called MonthDays to find the number of days in a given month Test your code with different input values to demonstrate that your function is robust?


How to write A Java program to print number of digits in a given number?

One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.


Shell program for gcd of three given numbers?

write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html


How do you write a program that outputs a given characters in reverse?

write the javascript code to display the reverse no. of given no. (e.g. 247 reverse of 742)


Write a program in C to find the complex number of a given number?

There is no such thing; you seem to have misunderstood something.Any real number can be regarded as a complex number with zero imaginary part, eg.: 5 = 5+0i


What is the number of nonoverlapping unit squares of a given size that will exactly cover the intrior of a plane?

Area


Do I need to write a program to find a substring in a given string in c plus plus?

No.