answersLogoWhite

0


Best Answer

#include
#include
#include
void main()
{
int i,n,sum=0;
clrscr();
printf("n=");
scanf("%d",&n);
for (i=1;i<=n;i++)
sum=sum+pow(i,2);
printf("sum=%d",sum);
getch();
}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program that uses a for loop to compute and print the sum of a given no of squares?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a C program to extract a given word from a file?

program to extract a given word from a file


How can you write a program specification for a given report?

It is your face


Shell program for gcd of three given numbers?

write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html


How do you write a program that outputs a given characters in reverse?

write the javascript code to display the reverse no. of given no. (e.g. 247 reverse of 742)


Do I need to write a program to find a substring in a given string in c plus plus?

No.


How do you write a c program to show How many Friday the 13th are there in a given year?

165


Write a c program to find given number is prime or not?

Yes, do write, or if you're too lazy to your homework, use google.


Write a c-program to compute compound interest after accepting the principal amount rate and time from user?

#this program to calculate princple amount using perl. print "enter the amount given;","\n"; $A=&lt;stdin&gt;; print "enter the rate of interst given;","\n"; $R=&lt;stdin&gt;; print "enter the no of years given;","\n"; $Y=&lt;stdin&gt;; $o=1+$R; $e=$o**$Y; $t=1/$e; $f=1-$t; $p= $A*$f; print "princple amount $p";


How many squares are in a hexagon?

you have not given enough information to answer, generally no squares are in hexagons.


How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


Is it possible to write a program using a micro-controller such that it can read the time and operate at a given time?

Yes.


Could you write a assembly language program in tasm To check whether a given number present in a sequence of given memory location containing the string to be checked in 8086?

8086 assembly language program to check wether given number is perfect or not