answersLogoWhite

0

#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

What else can I help you with?