Write a C program to find the sum of the first 15 even numbers and calculate the square of the sum
void main()
{
int c=1,i;
unsigned int s=0;
for(i=1;i<=15;i++)
{
if(i%2==0)
{
s=s+i;
c=c+i;
}
}
printf("Sum of the first 15 even numbers is: %d",s);
printf("Square of the sum is: %d",(s*s));
}
great post
ReplyDeleteivanka hot