sum of table of n

 #include <stdio.h>


int main()
{

    int i, sum = 0, n;
    printf("Enter the number:\n");
    scanf("%d", &n);
    for (i = 1; i <= 10; i++)
    {
        sum = sum + (n * i);
    }
    printf("The sum of %d is:%d", n, sum);
    return 0;
}

Comments

Popular posts from this blog

snake game Version-2 (using random number)

allocating dynamic memory using calloc

store a table in dynamic array and then change the size of array dynamically to store more numbers