Tuesday, March 5, 2024

9. 0+3+8+...+99

     

9. 0+3+8+...+99

=(1²-1)+(2²-1)+(3²-1)+...+(10²-1) :—


#include<stdio.h>

int main()

{

    int i,sum;

    sum=0;

    for(i=1;i<=10;i++)

    {

        sum=sum+i*i-1;

    }

    printf("%d",sum);

    return 0;

}


No comments:

Post a Comment