write a C++ program to store 5 numbers and print the square of it, using while loop.
Answers
Answered by
2
Answer:
#include<stdio.h>
main()
{
int n,i,sum;
i=1,sum=0;
printf("Enter Maximum Value(n):");
scanf("%d",&n);
while(i<=n)
{
sum=sum+i*i;
++i;
}
printf("Sum of squares of numbers from 1 to n is :%d ",sum);
}
Similar questions