Computer Science, asked by durbadatta1715, 9 months ago

write a C++ program to store 5 numbers and print the square of it, using while loop.​

Answers

Answered by rishu0246
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