//This program calculates the square of the given numbers (for 10 numbers) and add them with each other. //It can easily be converted to a series that calculates the sum of squares for natural numbers. #include #include void main() { // *** Variable Declaration *** int x,i; long int y,sum; i=10; sum=0; // *** The Main Body *** clrscr(); printf("This program takes 10 numbers and calculates the square of them. Each square will be added with the previos ones and the result will be shown.\n"); while(i) //While(i) means this loop will continue until 'i' reaches 0. In other word this loop will continue until 'i' is true. { printf("\nEnter a number please: "); scanf("%d",&x); y=x*x; sum=sum+y; printf("\nThe square of your number is: %d\n",y); printf("Total Sum = %d\n",sum); i--; } printf("\n*** This is the end of the program ***"); getch(); }