main()
{
int i,sumo=0,sume=0,oddno,evenno;
for(i=1,oddno=1,evenno=2;i<=100;++i,oddno=oddno+2,evenno=evenno+2)
{
sumo=sumo + oddno;
sume=sume + evenno;
}
printf("Sum of odd nos = %d And Sum of even nos = %d,sumo,sume);
}
#include<stdio.h>int main () {
int sum = 0;
for (int odd=3; odd<100; odd+=2) {
printf ("%d\n", odd);
sum += odd;
}
printf ("\nSum = %d\n", sum);
return 0;
}
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,sum=0;
for(i=2;i<=100;i=i+2)
{
sum=sum+i;
}
printf("sum of even no.%d",sum);
getch();
}
long sum = 0;
long i;
for (i=12; i<1000; i+=2) sum += i*i;
/* using long in case your compiler assumes 16 bit ints */
#include
#include <iostream> using namespace std; int main() { int i,sum; // variables sum = 0; // initialize sum /* recursive addition of squares */ for (i = 1; i <= 30; i++) sum = sum + (i * i); cout << sum <<" is the sum of the first 30 squares." << endl; return 0; }
1. Design an algorithm to compute sum of the squares of n numbers?
CLS PRINT "PROGRAM: Print squares of all even numbers from 1 to 20" PRINT PRINT "number", "squared" PRINT FOR number% = 1 TO 20 IF number% MOD 2 = 0 THEN PRINT number%, number% * number% END IF NEXT END
#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; }
There are an infinite amount of numbers that that have squares between 10 and 65
Squares of prime numbers have three factors.
#include
Difference between the sum of the squares and the square of the sums of n numbers?Read more:Difference_between_the_sum_of_the_squares_and_the_square_of_the_sums_of_n_numbers
There are two prime numbers with squares between 100 and 300. These prime numbers are 11 and 13. (112 = 121 and 132 = 169.)
Three numbers.
Two. 36, and 49 are perfect squares.
Rectangular numbers are a subset of composite numbers. The squares of prime numbers will be composite but not rectangular.
it is a triangle with circles at the corners, and squares in the middle of the corners. The squares have numbers in them, and you have to put numbers in the circles. However, the numbers in the circles have to add up to the number of the square between them. Simple, right?
39
1,4,9,16,25,36,49
1166650