#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;
}
program to extract a given word from a file
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.
write the javascript code to display the reverse no. of given no. (e.g. 247 reverse of 742)
see pages 43-49 in Principles of Program design by M. A. Jackson, 1975
To write a C++ program to display the student details using class and array of object.