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

comparing 2 dates using structures

free dynamic memory allocation

prime number