xxxxxxxxxx
#include<stdio.h>
main()
{
int n,i,sq,sosn;
printf("Enter a number: ");
scanf("%d",&n);
sq=i;
sosn=0;
printf("\nFormula: ");
i=1;
do
{
sq=i*i;
printf("%d=%d ",i,sq);
sosn+=(i*i);
i++;
}
while(i<=n);
printf("\nThe sum of the squared numbers is: %d",sosn);
}
xxxxxxxxxx
#include<stdio.h>
main()
{
int n,i,sq,sosn;
printf("Enter a number: ");
scanf("%d",&n);
sq=i;
sosn=0;
printf("\nFormula: ");
for(i=1;i<=n;i++)
{
sq=i*i;
printf("%d=%d ",i,sq);
sosn+=(i*i);
}
printf("\nThe sum of the squared numbers is: %d",sosn);
}
xxxxxxxxxx
#include<stdio.h>
main()
{
int n,sq;
n=1;
sq=n;
printf("Sequence numbers Squared");
do
{
printf("\n %d %d",n,sq);
n++;
sq=n*n;
}
while(n<=4);
printf("\n %d %d",n,sq);
}
xxxxxxxxxx
#include<stdio.h>
main()
{
int n,i,sq,sosn;
printf("Enter a number: ");
scanf("%d",&n);
sq=i;
sosn=0;
printf("\nFormula: ");
i=1;
while(i<=n)
{
sq=i*i;
printf("%d=%d ",i,sq);
sosn+=(i*i);
i++;
}
printf("\nThe sum of the squared numbers is: %d",sosn);
}